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

int n, m;
int pileIndex;
string cards;
string ops;
int q;
char flip[256];
string english[256];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  flip['U'] = 'D';
  flip['D'] = 'U';
  english['U'] = "up";
  english['D'] = "down";



  while (true) {
    cin >> n;
    if (n == 0) {
      break;
    }
    deque<stack<pair<int, char>>> piles;
    cin >> cards;
    for (int i = 0; i < cards.length(); i++) {
      stack<pair<int, char>> sc;
      sc.push(make_pair(i + 1, cards[i]));
      piles.push_back(sc);
    }

    cin >> ops;
    for (char op : ops) {
      if (op == 'R') {
        stack<pair<int, char>> pile_right = piles.back();
        piles.pop_back();
        while (!pile_right.empty()) {
         piles.back().push(make_pair(pile_right.top().first, flip[pile_right.top().second]));
         pile_right.pop();
        }
      } else {
        stack<pair<int, char>> pile_left = piles.front();
        piles.pop_front();
        while (!pile_left.empty()) {
          piles.front().push(make_pair(pile_left.top().first, flip[pile_left.top().second]));
          pile_left.pop();
        }
      }
    }
    vector<pair<int, char>> ud;
    while (!piles.front().empty()) {
      ud.push_back(piles.front().top());
      piles.front().pop();
    }

    cin >> m;
    cout << "Pile " << ++pileIndex << '\n';
    for (int i = 0; i < m; i++) {
      cin >> q;
      q--;
      cout << "Card " << q + 1 << " is a face ";
      cout << english[ud[q].second] << ' ' << ud[q].first << '.' << endl;
    }

  }
  return 0;
}