# Reasonably Sound

TIME LIMIT = 1 SEC.

- We don't always know what mysteries keep getting solved over at the Department of Mathematics, but we're sure it's a lot of fun. In any case, they constantly need a programmer's help to solve some complex problems. And, what do you know, they need our help yet again! This is what they want you to solve.

Given a set of N pairs of numbers:

- If one of the numbers is prime, and the other is even, the output should be such that when binary representation of the inputs is considered, the output bit should be 1, if and only if both the corresponding input bits are also 1.
- If one of the numbers is prime, and the other is odd, the output should be such that when binary representation of the inputs is considered, the bit should be 1, if at least one of the corresponding input bits is also 1.
- If both of the numbers are prime, the output should be such that when binary representation of the inputs is considered, the bit should be 1, if and only if one of the corresponding input bits is 1 and the other is 0.
- If both the numbers are even, but none of them is prime, simply print a/b (i.e. a divided by b), where a is the first number in the pair and b is the second number in the pair.
- If both the numbers are odd, but none of them is prime, simply print b/a (i.e. b divided by a), where a is the first number in the pair and b is the second number in the pair.
- If one of the numbers is even and the other one is odd, but none of them is prime, simply print −1.

Input | Output |

First line will contain N, the number of pairs of numbers. Each of the following N lines will contain two space-separated integers. |
For each pair, output on a new line the result of the operation on that pair. |

**Constraints**

- 1 ≤ N ≤ 1000
- 2 ≤ Each number in a pair ≤ 10
^{9}