using System; using System.Collections.Generic; using System.Linq; namespace yukicoder { public class Program { public static void Main() { var n = int.Parse(Console.ReadLine()); var b = new book[n]; for(var i = 0; i < n; i++) { var line = Console.ReadLine().Split(); b[i] = new book(); b[i].text = line[0]; b[i].id = line[1]; } var a = b.OrderBy(x => x.text).ThenBy(x => x.id); foreach(var s in a) { Console.WriteLine(s.text + " " + s.id); } } class book { public string text { set; get; } public string id { set; get; } } } }