#include <bits/stdc++.h>
using namespace std;
int main() {
  bool cards[4][14];
  int n, color, number;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> color >> number;
    if (color == 'S') color = 0;
    if (color == 'H') color = 1;
    if (color == 'C') color = 2;
    if (color == 'D') color = 3;
    cards[color][number] = 1;
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 14; j++) {
      if (cards[i][j] = 0) cout << cards[i][j] << "\n";
    }
  }
  return 0;
}
