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