using System.Text; using System; public class Hello { static void Main() { var n = int.Parse(Console.ReadLine().Trim()); var sb0 = new StringBuilder(); var sb1 = new StringBuilder(); for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Trim().Split(' '); if (line[0] == "0") sb0.Append(line[1]); else sb1.Append(line[1]); } var s1 = sb1.ToString().ToCharArray(); Array.Reverse(s1); Console.Write(new string(s1)); Console.WriteLine(sb0); } }