#include <bits/stdc++.h>
int main(void) {
  int cards[3][12] = {0};
  int check[3][12];
  int n, i, j, k, num;
  char type;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%c", &type);
    if (type == 'S') num = 0;
    if (type == 'H') num = 1;
    if (type == 'C') num = 2;
    if (type == 'D') num = 3;
    for (j = 0; j < n; j++) {
      scanf("%d", &cards[num][j]);
    }
  }
  printf("\n");
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      for (k = 0; k < 13; k++) {
        check[i][j] = k + 1;
      }
    }
    for (j = 0; j < 13; j++) {
      for (k = 0; k < 13; k++) {
        if (cards[i][k] == j) {
          check[i][j] = 0;
        }
      }
    }
    for (j = 0; j < 12; j++) {
      if (check[i][j] != 0) {
        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", check[i][j]);
      }
    }
  }
  return 0;
}
