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; int[] nums = tmp.Split(' ').Select(x => int.Parse(x)-1).ToArray(); var f = flags[nums[0]]; flags[nums[0]] = flags[nums[1]]; flags[nums[1]] = f; } for (int i = 0; i < flags.Length; i++) if (flags[i]) Console.WriteLine(i+1); } } }