import algorithm, sequtils, strutils func toH(s: string): string = let h = { "D":"0", "C":"1", "H":"2", "S":"3", "A":"1", "T":"a", "J":"b", "Q":"c", "K":"d", } return s.multiReplace h func fromH(s: string): string = let m = { "0":"D", "1":"C", "2":"H", "3":"S", } n = { "1":"A", "a":"T", "b":"J", "c":"Q", "d":"K", } result.add ($s[0]).multiReplace m result.add ($s[1]).multiReplace n let _, xs = stdin.readLine.split echo: xs.map(toH) .sorted .map(fromH) .join " "