{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\nAlice and Bob are playing a game. This game is played with several identical pots and one marble. When the game starts, Alice puts the pots in one line and puts the marble in one of the pots. After that, Bob cannot see the inside of the pots. Then Alice makes a sequence of swappings and Bob guesses which pot the marble is in. In each of the swapping, Alice chooses two different pots and swaps their positions.\n\u003c/p\u003e\n\u003cp\u003e\nUnfortunately, Alice\u0027s actions are very fast, so Bob can only catch \u003ci\u003ek\u003c/i\u003e of \u003ci\u003em\u003c/i\u003e swappings and regard these \u003ci\u003ek\u003c/i\u003e swappings as all actions Alice has performed. Now given the initial pot the marble is in, and the sequence of swappings, you are asked to calculate which pot Bob most possibly guesses. You can assume that Bob missed any of the swappings with equal possibility.\n\u003c/p\u003e\n\u003ch4\u003eInput\u003c/h4\u003e\n\u003cp\u003e\nThere are several test cases in the input file. The first line of the input file contains an integer \u003ci\u003eN\u003c/i\u003e (\u003ci\u003eN\u003c/i\u003e ≈ 100), then \u003ci\u003eN\u003c/i\u003e cases follow.\n\u003c/p\u003e\n\u003cp\u003e\nThe first line of each test case contains 4 integers \u003ci\u003en\u003c/i\u003e, \u003ci\u003em\u003c/i\u003e, \u003ci\u003ek\u003c/i\u003e and \u003ci\u003es\u003c/i\u003e(0 \u0026lt; \u003ci\u003es\u003c/i\u003e ≤ \u003ci\u003en\u003c/i\u003e ≤ 50, 0 ≤ \u003ci\u003ek\u003c/i\u003e ≤ \u003ci\u003em\u003c/i\u003e ≤ 50), which are the number of pots, the number of swappings Alice makes, the number of swappings Bob catches and index of the initial pot the marble is in. Pots are indexed from 1 to \u003ci\u003en\u003c/i\u003e. Then \u003ci\u003em\u003c/i\u003e lines follow, each of which contains two integers \u003ci\u003ea\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e and \u003ci\u003eb\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e (1 ≤ \u003ci\u003ea\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e, \u003ci\u003eb\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ≤ \u003ci\u003en\u003c/i\u003e), telling the two pots Alice swaps in the \u003ci\u003ei\u003c/i\u003e-th swapping.\n\u003c/p\u003e\n\u003ch4\u003eOutout\u003c/h4\u003e\n\u003cp\u003e\nFor each test case, output the pot that Bob most possibly guesses. If there is a tie, output the smallest one.\n\u003c/p\u003e\n\u003ch4\u003eSample\u003c/h4\u003e\n\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n3 1 1 1\n1 2\n3 1 0 1\n1 2\n3 3 2 2\n2 3\n3 2\n1 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n1\n3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n"}}]}