#include<stdio.h>
int main(void){
int n,x,a;
char ch;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%c %d",&ch,&x);
switch(ch){
case 'S':
a=15-x;
printf("S %d\n",a);
break;
case 'H':
a=15-x;
printf("H %d\n",a);
break;
case 'C':
a=15-x;
printf("S %d\n",a);
break;
case 'H':
a=15-x;
printf("H %d\n",a);
break;
            }
                  }
return 0;

}

