using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace yukicore { internal class Program { private static void Main(string[] args) { bool[] flags = new bool[3]; int No = int.Parse(Console.ReadLine())-1; flags[No] = true; Console.ReadLine(); while (true) { var tmp = Console.ReadLine(); if (tmp == null || tmp == "") break; // nums = tmp.Split(' ').Select(x => int.Parse(x)-1).ToArray(); int n0 = tmp[0]-48; int n1=tmp[2]-48; var f = flags[n0]; flags[n0] = flags[n1]; flags[n1] = f; } for (int i = 0; i < flags.Length; i++) if (flags[i]) Console.WriteLine(i+1); } } }