#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define endl '\n'

int main() {
	ios::sync_with_stdio(0);
	int n;
	int T = 1;
	while(cin >> n && n != 0) {
		cout << "Pile " << T << endl;
		string c, inp; cin >> c >> inp;
		int m; cin >> m;
		vi arr;
		for (int i=0; i<m; i++) {
			int tmp; cin >> tmp;
			arr.push_back(tmp);
		}

		//up = 0, down = 1
		vector<vector<pii>> cards(c.length(), vector<pii>());
		for (int i=0; i<c.length(); i++) {
			if (c[i] == 'U') {
				cards[i].push_back(pii(i,0));
			} else {
				cards[i].push_back(pii(i,1));
			}
		}
		for (int i=0; i<inp.length(); i++) {
			if (inp[i] == 'R') {
				for (auto p : cards[cards.size()-1]) {
					cards[cards.size()-2].insert(cards[cards.size()-2].begin(), pii(p.first,(p.second+1)%2));
				}
				cards.erase(cards.begin()+cards.size()-1);
			} else {
				for (auto p : cards[0]) {
					cards[1].insert(cards[1].begin(), pii(p.first,(p.second+1)%2));
				}
				cards.erase(cards.begin());
			}
		}
		for (int i=0; i<m; i++) {
			arr[i]--;
			pii curr = cards[0][arr[i]];
			cout << "Card " << arr[i]+1 << " is a face ";
			if (curr.second == 0) {
				cout << "up ";
			} else {
				cout << "down ";
			}
			cout << curr.first+1 << "." <<  endl;
		}
		cards.clear();
		arr.clear();
		T++;
	}
	return 0;
}