Problems
You have just received the best gift ever: an Expogo stick. You can stand on it and use it to make increasingly large jumps.
You are currently standing on point (0, 0) in your infinite two-dimensional backyard, and you are trying to reach a goal point (X, Y), with integer coordinates, in as few jumps as possible. You must land exactly on the goal point; it is not sufficient to pass over it on a jump.
Each time you use your Expogo stick to jump, you pick a cardinal direction: north, south, east, or west. The i-th jump with your Expogo stick moves you 2(i-1) units in the chosen direction, so your first jump takes you 1 unit, your second jump takes you 2 units, your third jump takes you 4 units, and so on.
Given a goal point (X, Y), determine whether it is possible to get there, and if so, demonstrate how to do it using as few jumps as possible.
Input
The first line of the input gives the number of test cases, T. T test cases follow. Each consists of a single line with two integers X and Y: the coordinates of the goal point.
Output
For each test case, output one line containing Case #x: y, where
x is the test case number (starting from 1) and y
is IMPOSSIBLE if the goal point cannot be reached. Otherwise,
y must be a string of one or more characters, each of which is
either N (north), S (south), E (east),
or W (west), representing the directions of the jumps that you
will make, in order. This sequence of jumps must reach the goal point at the
end of the final jump, and it must be as short as possible.
Example
4
2 3
-2 -3
3 0
-1 1
Case #1: SEN
Case #2: NWS
Case #3: EE
Case #4: IMPOSSIBLE