Mitin crib
Mitya was terribly afraid of reference in physics. therefore, he prepared a cheat sheet - long and narrow sheet of paper on which to print all the most important formulas. Leaflet will be too long, so you can just hide under a notebook. I had to turn. Mitya turned aside his sheet only along lines parallel to its original shortest edge. Effects of convolution along such lines, however, can be done in two directions: to turn a piece of paper up, or turn a piece of paper down. In both cases, the two parts of the rectangle are joined neatly together. You can designate the direction of folding the letter A, if the sheet has been folded clockwise rotation, or the letter V, signifying a turn counterclockwise. After a few times Mitya turned sheet of paper, he unfolded it and looked at him sideways. The result was a strange paper "accordion" - curve, consisting of line segments. "Accordion" can be deployed so that between any of its segments would be a 90 degree angle. Instead of preparing for the control of physics, Mitya began to write a program that is on the list of operations on a piece of paper will print the drawing of the resulting polygonal line. Mitya had turned a lot of cribs, trying to find the regularity of the resulting polygons. Program Mitya not, the clock is ticking and Mitya probably get an F in physics, if you do not help him cope with the problem!
Input In the input file contains multiple non-empty strings of characters A and V, describing the process of folding cribs. The first line contains the number of such lines. You can assume that the length of each line - no more than 200 characters. One line - this is one Mitina crib. Output For each line of input data display program drawing figures obtained. Start to draw the figure at the point with coordinates (300, 420) the command "300 420 moveto". The first rotation occurs at the point (310, 420) with the command "310 420 lineto". Then proceed clockwise or counterclockwise, rotating according to the input line. To move, use the command sequence "x y lineto" with the appropriate coordinates. Turning points should be located from one another at a distance of 10. Complete the program teams "stroke" and "showpage".