#include <bits/stdc++.h>
using namespace std;
int n;
char a[52];
int b[52];
bool have[4][52];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 'S') have[0][b[i]] = true;
    if (a[i] == 'H') have[1][b[i]] = true;
    if (a[i] == 'C') have[2][b[i]] = true;
    if (a[i] == 'D') have[3][b[i]] = true;
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < n; j++) {
      if (have[i][j] == false) printf("%d %d", i, j);
    }
  }
  return 0;
}
