#include <bits/stdtr1c++.h>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef complex<ld> pt;

deque<pair<int, char>> flip(deque<pair<int, char>> v) {
	reverse(v.begin(), v.end());
	for (auto& x : v) {
		x.second ^= 'U'^'D';
	}
	return v;
}

int main() {
	ios::sync_with_stdio(0);
	int n;
	while (cin >> n) {
		if (!n) break;
		string s; cin >> s;
		deque<deque<pair<int, char>>> v;
		for (int i = 0; i < s.size(); i++) {
			v.push_back({{i, s[i]}});
		}
		
		string t; cin >> t;
		for (char c : t) {
			if (c == 'R') {
				deque<pair<int, char>> w = v.back();
				v.pop_back();
				int j = int(v.size())-1;
				w = flip(w);
				if (j >= 0) {
					for (auto p : v[j]) {
						w.push_back(p);
					}
					v[j] = w;
				} else {
					v.push_back(w);
				}
			} else {
				deque<pair<int, char>> w = v.front();
				v.pop_front();
				int j = 0;
				w = flip(w);
				if (v.size() > 0) {
					for (auto p : v[j]) {
						w.push_back(p);
					}
					v[j] = w;
				} else {
					v.push_back(w);
				}
			}
		}
		
		int q; cin >> q;
		static int ca = 1;
		cout << "Pile " << ca++ << endl;
		while (q--) {
			int x; cin >> x;
			auto p = v[0][x-1];
			cout << "Card " << x << " is a face " << (p.second == 'U' ? "up" : "down") << ' ' << p.first+1 << '.' << endl;
		}
	}
	return 0;
}