#include<stdio.h>

int main(){
char n[4];
int n[4][13],j,i,a;
n[4] = {'S','H','C','D'}
for(i = 0; i < 4 ; i++){
  for(j = 0; j < 13; j++){
  n[i][j] = j+1;
  }
}
  int c[k],k;
  char b[k];
scanf("%d",&a);
for(k = 0; k < a; k++){
 
  scanf("%c %d",&b[k],&c[k]);
  if(b[k] == 'S'&& c[k] != n[0][k]){
  printf("%c %d",b[k],c[k]);
  }else if(b[k] == 'H'&& c[k] != n[1][k]){
  printf("%c %d",b[k],c[k]);
  }else if(b[k] == 'C' && c[k] != n[2][k]){
  printf("%c %d",b[k],c[k]);
  }else if(b[k] == 'D' && c[k] != n[3][k]){
  printf("%c %d",b[k],c[k]);
  }
}

return 0;
}
