import java.util.*;
public class Main {
public static void main(String[] args) {
String s[]=new String[54];
for (int i=0;i<52;i++){//将数字转化成扑克的名称
int color=i/13;
int num=i%13;
if (color==0){
s[i]="S";
}
else if (color==1){
s[i]="H";
} else if (color==2) {
s[i]="C";
} else if (color==3) {
s[i]="D";
}
s[i]+=(num+1);
}
s[52]="J1";
s[53]="J2";
Scanner scanner=new Scanner(System.in);
int k= scanner.nextInt();
int pos[]=new int[54];
for (int i=0;i<54;i++){
pos[i]=scanner.nextInt();
}
while (k-->0){
String temp[]=new String[54];//暂存
for (int i=0;i<54;i++){
temp[pos[i]-1]=s[i];//pos[i]-1因为从1开始而不是0开始
}
for (int i=0;i<54;i++){
s[i]=temp[i];
}
}
String str="";
for (int i=0;i<54;i++){
str=str+s[i]+" ";
}
System.out.println(str.substring(0, str.length()-1));
}
}