#include <stdio.h>

int main(void)
{
  int n = 0;
  int card[52][5];
  int i, j;

  scanf("%d", &n);

  for(i = 0; i < n; i++)
    scanf("%s", card[i]);

  for(i = 0; i < n; i++)
    if(card[i][0] == 'S'){
      for(j = 1; j < 10; j++){
	if(for(j = 1; j < 10; j++)
	     card[i][2] == 'j' && card[i][3] == '\0')
	  ;
	else
	  printf("S %d\n", j);
      }
      for(j = 0; j < 4; j++){
	if(for(j = 0; j < 4; j++)
	     card[i][2] == '1' && card[i][3] == 'j')
	  ;
	else
	  printf("S 1%d\n", j);
      }
    }

  for(i = 0; i < n; i++)
    if(card[i][0] == 'H'){
      for(j = 1; j < 10; j++){
	if(for(j = 1; j < 10; j++)
	     card[i][2] == 'j' && card[i][3] == '\0')
	  ;
	else
	  printf("H %d\n", j);
      }
      for(j = 0; j < 4; j++){
	if(for(j = 0; j < 4; j++)
	     card[i][2] == '1' && card[i][3] == 'j')
	  ;
	else
	  printf("H 1%d\n", j);
      }
    }

  for(i = 0; i < n; i++)
    if(card[i][0] == 'C'){
      for(j = 1; j < 10; j++){
	if(for(j = 1; j < 10; j++)
	     card[i][2] == 'j' && card[i][3] == '\0')
	  ;
	else
	  printf("C %d\n", j);
      }
      for(j = 0; j < 4; j++){
	if(for(j = 0; j < 4; j++)
	     card[i][2] == '1' && card[i][3] == 'j')
	  ;
	else
	  printf("C 1%d\n", j);
      }
    }

  for(i = 0; i < n; i++)
    if(card[i][0] == 'D'){
      for(j = 1; j < 10; j++){
	if(for(j = 1; j < 10; j++)
	     card[i][2] == 'j' && card[i][3] == '\0')
	  ;
	else
	  printf("D %d\n", j);
      }
      for(j = 0; j < 4; j++){
	if(for(j = 0; j < 4; j++)
	     card[i][2] == '1' && card[i][3] == 'j')
	  ;
	else
	  printf("D 1%d\n", j);
      }
    }
  
  return 0;
}