An Animal Contest 7 P1 - Squirrnect 4

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Andrew was playing Connect 4 with his friend Julian when a squirrel came up and challenged him to a duel. Secretly, it was on an information gathering mission to see how Earth's strategists fared against squirrel intellect. If Andrew lost, the squirrel nation would deem Earth a suitable place to invade. It turns out that squirrels are not actually native to Earth and are not as nice as they seem ...

Squirrel Connect 4, or Squirrnect 4, is slightly different compared to the conventional version of Connect 4: The board is customizable and can have any positive integer width w and height h. Unfortunately, certain dimensions for the board are bad, since they would cause any games played on it to be a tie, regardless of how the two players move. This would hinder Andrew's goal of winning, so before they play each of t matches, Andrew will tell you the dimensions of the board, and you must tell him whether or not it is bad.

Connect 4 explanation

Two players alternately drop tokens down the columns of a w by h sized board. The tokens fall straight down, stopping at the lowest cell not already occupied by another token. The first person to stack four of their own tokens in a line — whether it be horizontal, vertical or diagonal — wins.

Constraints

1 \leq t \leq 2 \times 10^5

1 \leq w, h \leq 10^9

Input Specification

The first line will contain a single integer t.

The next t lines will contain two space-separated integers w and h.

Output Specification

Output t lines. On each line, output bad if the corresponding board dimensions are bad; otherwise, output good.

Sample Input

5
1 1
22 13
3 3
7 1
2 4

Sample Output

bad
good
bad
good
good

Comments


  • 4
    SkyTian  commented on Dec. 26, 2022, 1:30 a.m.

    Squirrels are something else.