#include using namespace std; typedef long long ll; int main() { int n; cin>>n; pair c[n]; int a[256]; a[1]='A'; a[2]='D'; a[3]='C'; a[4]='H'; a[5]='S'; a[10]='T'; a[11]='J'; a[12]='Q'; a[13]='K'; a['A']=1; a['D']=2; a['C']=3; a['H']=4; a['S']=5; a['T']=10; a['J']=11; a['Q']=12; a['K']=13; for (int i=0;i>s; int suit=a[s[0]]; int num=isdigit(s[1])?s[1]-'0':a[s[1]]; c[i]={suit,num}; } sort(c,c+n); for (auto p:c) { char suit=a[p.first]; char num=(2<=p.second&&p.second<=9)?p.second+'0':a[p.second]; cout<