using System; using System.Collections.Generic; using System.Linq; class Program { static string InputPattern = "Input3"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("1"); WillReturn.Add("1"); WillReturn.Add("1 3"); } else if (InputPattern == "Input2") { WillReturn.Add("1"); WillReturn.Add("3"); WillReturn.Add("2 3"); WillReturn.Add("3 2"); WillReturn.Add("2 3"); } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List InputList = GetInputList(); int MaruCup = int.Parse(InputList[0]); foreach (string EachChangeInfo in InputList.Skip(2)) { string[] wkArr = EachChangeInfo.Split(' '); int FromCup = int.Parse(wkArr[0]); int ToCup = int.Parse(wkArr[1]); if (FromCup == MaruCup) MaruCup = ToCup; else if (ToCup == MaruCup) MaruCup = FromCup; } Console.WriteLine(MaruCup); } }