Pogo Stick

Reach (X, Y) with jumps of length 1, 2, and so on in four directions using the fewest jumps, breaking ties by alphabetical order.

Medium7MathGreedyNo attempts yetTime limit5sMemory limit512 MB

Problem

You just got a pogo stick. You stand on it and jump: the first jump moves you 1 unit, the second jump moves you 2 units, the third jump moves you 3 units, and every later jump is one unit longer than the one before it.

Each jump goes in exactly one of four directions: north (yy increases), south (yy decreases), east (xx increases), or west (xx decreases). You cannot skip a jump and you cannot shorten one.

You start at (0,0)(0, 0) on an infinite plane and want to land exactly on (X,Y)(X, Y). The target is never (0,0)(0, 0), and it can always be reached.

Input

The first line contains the number of test cases TT. Each of the next TT lines contains two integers XX and YY separated by a single space, the coordinates of the target.

  • 1T501 \le T \le 50
  • 0X,Y1000 \le |X|, |Y| \le 100
  • (X,Y)(0,0)(X, Y) \ne (0, 0)

Output

For each test case print one line in the form Case #x: y, where xx is the case number starting from 1 and yy is a string of directions. Write N for north, S for south, E for east, and W for west. The ii-th character is the direction of the ii-th jump, which covers ii units.

Use the smallest possible number of jumps. When several shortest sequences land on (X,Y)(X, Y), print the alphabetically smallest of them, comparing letters in the order E < N < S < W.