#K49477. Taco Tree Pattern
Taco Tree Pattern
Taco Tree Pattern
You are given two integers \(O\) and \(P\) representing the number of Oak and Pine trees respectively. Your task is to determine whether it is possible to arrange these trees into a pattern. The arrangement is considered POSSIBLE if the trees can be organized into rows such that:
- The number of Oak trees equals the number of Pine trees, i.e. \(O = P\).
- There exists at least one divisor \(d\) of \(O\) (and \(P\)) representing the number of rows such that the trees are equally distributed among them.
Note that when \(O = P\), the divisor condition is always met. Otherwise, the arrangement is deemed IMPOSSIBLE.
inputFormat
The first line contains a single integer \(T\) (\(T \ge 1\)) representing the number of test cases. Each of the following \(T\) lines contains two space-separated integers \(O\) and \(P\) — the counts of Oak and Pine trees respectively.
outputFormat
For each test case, output a single line containing the string POSSIBLE
if the trees can be arranged as described, or IMPOSSIBLE
otherwise.
3
4 4
5 10
6 9
POSSIBLE
IMPOSSIBLE
IMPOSSIBLE
</p>