Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

M. Math lesson
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Professor S is teaching his students A, T, and R the arcane arts of mathematical magic (otherwise known as mathgic). Part of this is learning to draw geometric figures, so they have to complete the following exercise.

They were be given a 2D plane, first A drew $$$n$$$ vertical lines $$$X=x_0, X=x_1,\ldots,X=x_{n-1}$$$. Afterwards J drew $$$m$$$ horiontal lines $$$Y=y_0,Y=y_1,\ldots, Y=y_{m-1}$$$. Finally R drew a diagonal line $$$D$$$ from point $$$(h,0)$$$ to $$$(h+l,l)$$$.

The challenge that was then given to them is:

For each point that the line $$$D$$$ has integer coordinates, a ray is drawn from there perpendicular to the line and to the right. i.e. from point $$$(x,0)$$$ the ray goes in direction $$$(x-1,1)$$$. Then answer, which line will it intersect first?

Input

On the first line, two numbers $$$N,M$$$ such that $$$1\leq N,M,N+M\leq 10^6 $$$

On the second line $$$N$$$ integers $$$x_0,x_1,\ldots,x_{n-1}$$$ ($$$0\leq x_i\leq 2\times10^6$$$) representing the $$$N$$$ lines drawn by A, all of them diferent.

On the third line $$$M$$$ integers $$$y_0,y_1,\ldots,y_{m-1}$$$ ($$$0\leq y_i \leq 2\times10^6$$$) representing the $$$M$$$ lines drawn by T, all of them diferent.

In the fourth and last line, the two numbers $$$0\leq h,l \leq 10^6$$$.

Output

The answers from the challenge in the order of the points from were the rays are drawn, from left to right. If the first line intersected is vertical print the letter A followed by the index of the line. Otherwise, if the first line is horizontal, print the letter T followed by the index of the line. In case of ties where it intersects a horizontal and vertical line at the same time, print the horizontal one. In case the ray doesn't intersect any line, print -1.

Example
Input
1 1
1
3
0 3
Output
T0 A0 A0 T0