#include <bits/stdc++.h>
int main(void) {
  int n, a, i, j, s;
  char c;
  int cards[4][13];
  scanf("%d", &n);
  for (a = 0; a < n; a++) {
    scanf("%c %d", &c, &s);
    if (c == 'S') {
      c = 0;
    } else if (c == 'H') {
      c = 1;
    } else if (c == 'C') {
      c = 2;
    } else if (c == 'D') {
      c = 3;
    }
    cards[c][s] = 1;
  }
  for (i = 0; i < 4; i++) {
    for (j = 1; j <= 13; j++) {
      if (cards[i][j] != 1) {
        printf("%d\n", cards[i][j]);
      }
    }
  }
  return 0;
}
