#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> s;
  vector<int> h;
  vector<int> c;
  vector<int> d;
  for (int i = 0; i < n; i++) {
    char a;
    int b;
    cin >> a >> b;
    switch (a) {
      case 'S':
        s.push_back(b);
        break;
      case 'H':
        h.push_back(b);
        break;
      case 'C':
        c.push_back(b);
        break;
      case 'D':
        d.push_back(b);
        break;
      default:
        break;
    }
  }
  sort(s.begin(), s.end());
  sort(h.begin(), h.end());
  sort(c.begin(), c.end());
  sort(d.begin(), d.end());
  for (vector<int>::iterator itr = s.begin(); itr < s.end(); itr++) {
    int cnt = 1;
    while (1) {
      if (*itr > cnt) {
        cout << "S " << cnt << endl;
        cnt++;
      } else {
        break;
      }
    }
  }
  for (vector<int>::iterator itr = h.begin(); itr < h.end(); itr++) {
    int cnt = 1;
    while (1) {
      if (*itr > cnt) {
        cout << "H " << cnt << endl;
        cnt++;
      } else {
        break;
      }
    }
  }
  for (vector<int>::iterator itr = c.begin(); itr < c.end(); itr++) {
    int cnt = 1;
    while (1) {
      if (*itr > cnt) {
        cout << "C " << cnt << endl;
        cnt++;
      } else {
        break;
      }
    }
  }
  for (vector<int>::iterator itr = d.begin(); itr < d.end(); itr++) {
    int cnt = 1;
    while (1) {
      if (*itr > cnt) {
        cout << "D " << cnt << endl;
        cnt++;
      } else {
        break;
      }
    }
  }
  return 0;
}
