package yukicoder; import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class Main{ public static void main(String[] args)throws Exception{ new Main().solve(); } final String suit="DCHS"; final String num="A23456789TJQK"; void solve(){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String[] s=new String[n]; for(int i=0;i(){ @Override public int compare(String o1, String o2) { int s1=suit.indexOf(o1.charAt(0)); int s2=suit.indexOf(o2.charAt(0)); if(s1!=s2)return s1-s2; else{ return num.indexOf(o1.charAt(1))-num.indexOf(o2.charAt(1)); } } }); for(int i=0;i