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