Flipper is a solitaire memory game. You start with $n$ cards, numbered 1 through $n$, laid out in a row in order from left to right (card 1 at the far left, card $n$ at the far right). Some cards are face up and some are face down.
You then perform $n - 1$ flips, each either a right flip or a left flip. In a right flip you take the pile at the far right and flip it over onto the pile immediately to its left. Flipping a pile over reverses the order of its cards and turns every card over (a face-up card becomes face down, and vice versa), and the flipped cards land on top of the pile they are dropped onto. For example, if the rightmost pile is A, B, C (from top to bottom) and card D is immediately to its left, then flipping that pile onto D produces a single pile of four cards C, B, A, D (from top to bottom). A left flip is analogous: you take the pile at the far left and flip it over onto the pile immediately to its right.
After the last flip there is a single pile, some cards face up and some face down. For example, deal out 5 cards (numbered 1 through 5) with cards 1, 2, 3 initially face up and cards 4, 5 initially face down. Performing 2 right flips and then 2 left flips leaves the pile, from top to bottom: a face-down 2, a face-up 1, a face-up 4, a face-down 5, and a face-up 3.
Write a program that, after the flips, can report which card lies at any queried position.
Each test case consists of four lines. The first line contains a positive integer $n$ ($2 \le n \le 100$), the number of cards laid out. The second line is a string of $n$ characters: U means the card in that position is dealt face up and D means face down. The third line is a string of $n - 1$ characters giving the order of the flips: R for a right flip and L for a left flip. The fourth line has the form m q1 q2 ... qm, where $m$ is a positive integer and each $q_i$ ($1 \le q_i \le n$) queries a position in the final pile (position 1 is the top card, position $n$ is the bottom card).
A line containing a single 0 indicates the end of the input.
Each test case produces $m + 1$ lines of output. The first line has the form
Pile t
where $t$ is the test case number (starting at 1). Each of the next $m$ lines, for $i = 1, \ldots, m$, has the form
Card qi is a face up k.
or
Card qi is a face down k.
according to whether the card at position $q_i$ ends face up or face down, where $k$ is that card's number. For example, in the 5-card case above, if $q_i = 3$ the answer is Card 3 is a face up 4.