P7892 "JROI-3" Track and Field

Background

You are getting ready to play MC.

Description

You need to use fences to enclose a rectangular area. Suppose this rectangle has size $a \times b$ pixel cells. Then you need a fence frame of size $(a+1)$ in length and $(b+1)$ in width to enclose this area. Now you find that your sheep and cows need **exactly** $n$ pixel cells to survive, and you have $m$ fences in your backpack. You want to know whether, with the fences you have, you can enclose $n$ pixel cells. You do not need to use up all fences. As long as you can enclose a rectangle whose area is $n$ pixel cells. Note that $a,b,n,m$ above must all be integers.

Input Format

The first line contains an integer $T$, the number of test cases. The next $T$ lines each contain two integers $n,m$, as described.

Output Format

Output one string per line. If it is possible, output `Good`; otherwise, output `Miss`.

Explanation/Hint

#### Sample 1 Explanation First test case: It can be verified that it is impossible to use $1$ fence to enclose $4$ pixel cells. Second test case: You can consider enclosing $4=1 \times 4$ pixel cells as follows. ![](https://cdn.luogu.com.cn/upload/image_hosting/bho8z78k.png) Using the method below only requires $14$ fences. ![](https://cdn.luogu.com.cn/upload/image_hosting/o8s6bz81.png) The fence width is $1+1=2$, the length is $4+1=5$, and $(2+5) \times 2=14$. #### Constraints and Notes **This problem uses bundled tests.** - Subtask 1 (30 pts): $1\le n,m \le 10^4$, $T \leq 10^3$; - Subtask 2 (70 pts): $1\le n,m \le 10^{8}$, $T \leq 10^3$. ---- In this problem, fences are **abstract** rather than concrete. That is, a fence will **degenerate into a point rather than a cell**. So we can compute how many fences a fence frame consumes by **computing the perimeter** (if you do not understand, you can look at the Sample 1 explanation). Translated by ChatGPT 5