import java.util.*;
import java.io.*;

/**
 * Created by IntelliJ IDEA.
 * User: o_00
 * Date: 19.10.2009
 * Time: 15:49:33
 * To change this template use File | Settings | File Templates.
 */
public class Flipper implements Runnable {
    final String fName = "flipper";

    int nextInt ( StreamTokenizer in ) throws Exception {
        in.nextToken();
        return (int)in.nval;
    }

    public void run() {
        try {
            //StreamTokenizer in = new StreamTokenizer( new BufferedReader( new FileReader( new File( fName + ".out" ) ) ) );
            Scanner in = new Scanner( new File( fName + ".in" ) );
            PrintWriter out = new PrintWriter( new File( fName + ".out" ) );
            int test = 0;
            int n = in.nextInt();
            while (n != 0){
                test++;
                char[] s = in.next().toCharArray();
                char[] p = in.next().toCharArray();
                int[][] t = new int[n][n];
                boolean[][] f = new boolean[n][n];
                int[] num =  new int[n];
                for(int i = 0; i < n; i++){
                    f[i][0] = ( s[i] == 'U' );
                    t[i][0] = i;
                    num[i] = 1;
                }
                int left  = 0;
                int right = n - 1;
                for(int i = 0; i < n - 1; i++){
                    if ( p[i] == 'R' ){
                        right--;
                        for(int j = num[right + 1] - 1; j >= 0; j--){
                            t[right][num[right]] = t[right + 1][j];
                            f[right][num[right]] = !f[right + 1][j];
                            num[right]++;
                        }
                    } else {
                        left++;
                        for(int j = num[left - 1] - 1; j >= 0; j--){
                            t[left][num[left]] = t[left - 1][j];
                            f[left][num[left]] = !f[left - 1][j];
                            num[left]++;
                        }
                    }
                    /*
                    for(int j = 0 ;j < n; j++){
                        for(int k = 0; k < num[j]; k++)
                            out.print( t[j][k] + " ");
                        out.println();
                    }
                    out.println();
                    */
                }
                int m = in.nextInt();
                out.println("Pile " + test);
                for(int i = 0; i < m; i++){
                    int c = in.nextInt();
                    out.print("Card " + c + " is a face ");
                    if (f[left][num[left] - c]) out.print("up ");
                    else out.print("down ");
                    out.println((t[left][num[left] - c] + 1) + ".");
                }
                n = in.nextInt();
            }
            in.close();
            out.close();
        } catch ( Exception e ) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    public static void main( String[] args ){
        new Thread( new Flipper() ).start();
    }
}
