#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int cards[4][13];
  for (int i = 0; i < n; i++) {
    string a;
    int b;
    cin >> a >> b;
    if (a == "S") {
      cards[0][b] = 1;
    }
    if (a == "H") {
      cards[1][b] = 1;
    }
    if (a == "C") {
      cards[2][b] = 1;
    }
    if (a == "D") {
      cards[3][b] = 1;
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (cards[i][j] == 1) {
        cout << cards[i][j];
      }
    }
  }
}
