#include <bits/stdc++.h>
using namespace std;
int main() {
  char x;
  int n, y, i, S, H, C, D;
  bool cards[4][13] = {false};
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    if (x == 'S') {
      cards[0][y] = true;
    } else if (x == 'H') {
      cards[1][y] = true;
    } else if (x == 'C') {
      cards[2][y] = true;
    } else if (x == 'D') {
      cards[3][y] = true;
    }
    cards[x][y] = true;
    cout << false << endl;
  }
  return 0;
}
