using System; namespace No267_1{ public class Program{ public static void Main(string[] args){ Console.ReadLine(); var cards = Console.ReadLine().Split(' '); var suit = new[]{'D', 'C', 'H', 'S'}; var num = new[]{'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K'}; Func order = str => Array.IndexOf(suit, str[0]) * 13 + Array.IndexOf(num, str[1]); Array.Sort(cards, (s1, s2) => order(s1) - order(s2)); Console.WriteLine(string.Join(" ", cards)); } } }