#include <bits/stdc++.h>
using namespace std;
int main() {
  char c[4][13];
  int cc[4][13], tramp[4][13];
  int num;
  cin >> num;
  for (int k = 0; k < 4; ++k) {
    for (int i = 0; i < 13; ++i) {
      if ((k + 1) * (i + 1) < num) {
        cin >> c[k][i] >> tramp[k][i];
        switch (c[k][i]) {
          case 'S':
            cc[k][i] = 0;
            break;
          case 'H':
            cc[k][i] = 1;
            break;
          case 'C':
            cc[k][i] = 2;
            break;
          case 'D':
            cc[k][i] = 3;
            break;
          default:
            cc[k][i] = 0;
            break;
        }
      } else {
        c[k][i] = '0';
        tramp[k][i] = 0;
      }
    }
  }
  bool f_find = false;
  for (int i = 0; i < 4; ++i) {
    for (int k = 0; k < 13; ++k) {
      for (int l = 0; l < 4; ++l) {
        for (int m = 0; m < 13; ++m) {
          if (cc[l][m] == i && tramp[l][m] == k + 1) {
            f_find = true;
          }
        }
      }
      if (!f_find) {
        switch (i) {
          case 0:
            cout << "S " << k + 1 << endl;
            break;
          case 1:
            cout << "H " << k + 1 << endl;
            break;
          case 2:
            cout << "C " << k + 1 << endl;
            break;
          case 3:
            cout << "D " << k + 1 << endl;
            break;
        }
      } else {
        f_find = false;
      }
    }
  }
}
