The first line of the input is an integer t (1 <= t <= 20), representing the number of ropes. Each of the following lines describes a rope.
We describe the rope by pointing out the cross-point (See Figure_2). We first number all the cross-point. Then, our fingers go along the rope from one end to the other, whenever we encounter a cross-point we will record its number on the paper. If the rope goes above the point, we write down a positive number. If the rope goes under the point, we write down a negative number. In the end, we put a zero as an end sign. For example, the rope shown in Figure_2 is recorded as:
+1 -2 +3 -4 +5 -6 -7 +8 +2 -1 -10 +9 -8 -3 +4 -5 +6 +7 -9 +10 0
Figure_2