Bender B. Rodríguez Problem |
The first line of each test case gives an integer L (2
The end of the input is indicated when L=0.
For each case in the input, print one line with the direction pointed by the last segment of the wire, +x, -x, +y, -y, +z or -z depending on the case.
Bender needs to bend a wire of length L (L
Bender bends the wire at specific points, starting at the point (L-1,0,0) and ending at the point (1,0,0). For each i from L-1 to 1, Bender can take one of the following decisions:
For example, if L=3 and Bender bends the wire at (2,0,0) on the +y axis direction, and at (1,0,0) on the -y axis direction, the result would be:
Given a sequence of bends, you must determine what direction is pointed by the last segment of the wire (+x in the example). You can suppose that the wire can intercept itself, after all it is the future!
Input
The second line of each test case contains the L-1 decisions taken by Bender at each point, separated by spaces. The j-th decision in the list (for each 1
Output
Sample Input
3
+z -z
3
+z +y
2
+z
4
+z +y +z
5
No +z No No
0
Sample Output
+x
+z
+z
-x
+z
Colombia'2008