#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, o, p, q, r, z;
  b = 0;
  cin >> n;
  string* M = new string[n];
  int* K = new int[n];
  for (a = 0; a < n; a++) {
    cin >> M[a] >> K[a];
  }
  o = p = q = r = 15;
  int* S = new int[o];
  for (a = 0; a < o; a++) {
    S[a] = a + 1;
  }
  int* H = new int[p];
  for (a = 0; a < p; a++) {
    H[a] = a + 1;
  }
  int* C = new int[q];
  for (a = 0; a < q; a++) {
    C[a] = a + 1;
  }
  int* D = new int[r];
  for (a = 0; a < r; a++) {
    D[a] = a + 1;
  }
  for (a = 0; a < n; a++) {
    if (M[a] == "S") {
      for (c = S[K[a] - 1]; c < o; c++) {
        z = S[c - 1];
        S[c - 1] = S[c];
        S[c] = z;
      }
      b = b + 1;
    }
  }
  o = o - b;
  b = 0;
  for (a = 0; a < n; a++) {
    if (M[a] == "H") {
      for (c = H[K[a] - 1]; c < o; c++) {
        z = H[c - 1];
        H[c - 1] = H[c];
        H[c] = z;
      }
      b = b + 1;
    }
  }
  p = p - b;
  b = 0;
  for (a = 0; a < n; a++) {
    if (M[a] == "C") {
      for (c = C[K[a] - 2]; c < o; c++) {
        z = C[c - 1];
        C[c - 1] = C[c];
        C[c] = z;
      }
      b = b + 1;
    }
  }
  q = q - b;
  b = 0;
  for (a = 0; a < n; a++) {
    if (M[a] == "D") {
      for (c = D[K[a] - 2]; c < o; c++) {
        z = D[c - 1];
        D[c - 1] = D[c];
        D[c] = z;
      }
      b = b + 1;
    }
  }
  r = r - b;
  for (a = 0; a < o; a++) {
    cout << "S " << S[a] << endl;
  }
  for (a = 0; a < p; a++) {
    cout << "H " << H[a] << endl;
  }
  for (a = 0; a < q; a++) {
    cout << "C " << C[a] << endl;
  }
  for (a = 0; a < r; a++) {
    cout << "D " << D[a] << endl;
  }
  return 0;
}
