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