Bob's favorite pastime over the summer break is doing Sudoku puzzles. This summer, he has decided to expand his horizons to other puzzles since he has so much extra time on his hands. In particular, he has become interested in a new puzzle involving a by grid.
The objective of the game is to fill in all of the cells with positive integers such that each row, when read left to right, and each column, when read top to bottom, form geometric sequences. As a refresher, geometric sequences of length have the following form (where and are positive real numbers).
Bob has already completed the puzzle. However, he would like you to write a program that checks that his solution is valid according to the rules.
Input Specification
There will be lines of input each containing space-separated integers, the values in the grid .
Output Specification
Output GOOD
if the grid is valid and BAF
otherwise.
Sample Input 1
4 4 4
8 12 18
16 36 81
Sample Output 1
GOOD
Sample Input 2
1 2 3
4 5 6
7 8 9
Sample Output 2
BAF
Comments