Gazua
InterviewTime limit1sMemory limit512 MB
Each test case gives K; decide if K equals a sum of at least two consecutive integers in 1 to K-1, printing "Gazua" on yes and "GoHanGang" on no.
- Level
Medium5 of 10
- Topics
- Math, Number theory, Implementation
- Solved
- No attempts yet
Problem
Byungkyu, who enjoys gambling, visited Cosmos Land, the largest casino in Korea, during his vacation. Filled with dreams of getting rich quick, he joined several games but lost half of his fortune within an hour of entering.
Byungkyu, who had always been confident in blackjack, sat down at a blackjack table as his last hope. Cosmos Land was running a game called "HY Blackjack," a slightly different version of ordinary blackjack. The rules are as follows.
- The dealer draws one ball with an integer of at least 2 written on it from a lottery machine. If the number drawn is K, the dealer's number is K.
- The player checks the dealer's number K, then takes cards so that their sum is exactly K to win the game.
- Each card has an integer written on it. Unlike ordinary playing cards, the integers from 1 to K-1 each appear once, sorted in ascending order. The player may take only a few consecutive cards.
- If the player cannot make the dealer's number K as the sum of consecutive cards, the player loses.
For example, if the number on the ball drawn by the dealer is 9, Byungkyu can make 9 as the sum of the consecutive cards 2, 3, 4, so Byungkyu wins. But if the number on the ball drawn by the dealer is 4, he cannot make 4 as the sum of consecutive cards, so Byungkyu loses.
Given K, write a program that tells whether Byungkyu can win, and help him out!
Input
The first line gives the number of test cases N (1 ≤ N ≤ 103). The next N lines each contain one test case. Each test case gives the number K drawn by the dealer (2 ≤ K ≤ 109).
Output
For each case, print "Gazua" if Byungkyu can win, and "GoHanGang" if there is no way for Byungkyu to win. (Do not print the quotation marks.)