{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"Section1\"\u003e\r\n\t\u003cp class\u003d\"MsoNormal\"\u003e\r\n\t\t\u003cspan style\u003d\"text-align: justify;\"\u003eYour non-profit organization (\u003c/span\u003e\u003cspan class\u003d\"SpellE\" style\u003d\"text-align: justify;\"\u003e\u003cb\u003e\u003cspan data-scayt_word\u003d\"iCORE\" data-scaytid\u003d\"1\"\u003eiCORE\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e - \u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003ei\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003enternational \u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003eC\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003eonfederation of \u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003eR\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003eevolver \u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003eE\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003enthusiasts) coordinates a very successful foreign student exchange program. Over the last few years, demand has sky-rocketed and now you need assistance with your task.\u003c/span\u003e\u003c/p\u003e\r\n\t\u003cp style\u003d\"text-align:justify\"\u003e\r\n\t\tThe program your organization runs works as follows: All candidates are asked for their original location and the location they would like to go to. The program works out only if every student has a suitable exchange partner. In other words, if a student wants to go from A to B, there must be another student who wants to go from B to A. This was an easy task when there were only about 50 candidates, however now there are up to \u003cb style\u003d\"mso-bidi-font-weight:normal\"\u003e500000\u003c/b\u003e candidates!\u003c/p\u003e\r\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cspan style\u003d\"text-align: justify;\"\u003eThe input file contains multiple cases. Each test case will consist of a line containing\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003en\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e\u0026nbsp;- the number of candidates\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003e(\u003cspan data-scayt_word\u003d\"1≤n≤500000\" data-scaytid\u003d\"2\"\u003e1\u0026le;n\u0026le;500000\u003c/span\u003e)\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e, followed by\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003en\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e\u0026nbsp;lines representing the exchange information for each candidate. Each of these lines will contain\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003e2\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e\u0026nbsp;integers, separated by a single space, representing the candidate\u0026#39;s original location and the candidate\u0026#39;s target location respectively. Locations will be represented by nonnegative integer numbers. You may assume that no candidate will have his or her original location being the same as his or her target location as this would fall into the domestic exchange program. The input is terminated by a case where\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003en\u003c/b\u003e\u003cb style\u003d\"text-align: justify;\"\u003e\u0026nbsp;\u003d\u0026nbsp;0\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e; this case should not be processed.\u003c/span\u003e\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\r\n\t\u003cspan style\u003d\"text-align: justify;\"\u003eFor each test case, print\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003e\u0026quot;YES\u0026quot;\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e\u0026nbsp;on a single line if there is a way for the exchange program to work out, otherwise print\u0026nbsp;\u003c/span\u003e\u003cb style\u003d\"text-align: justify;\"\u003e\u0026quot;NO\u0026quot;\u003c/b\u003e\u003cspan style\u003d\"text-align: justify;\"\u003e.\u003c/span\u003e\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e\r\n10\r\n1 2\r\n2 1\r\n3 4\r\n4 3\r\n100 200\r\n200 100\r\n57 2\r\n2 57\r\n1 2\r\n2 1\r\n10\r\n1 2\r\n3 4\r\n5 6\r\n7 8\r\n9 10\r\n11 12\r\n13 14\r\n15 16\r\n17 18\r\n19 20\r\n0\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e\r\nYES\r\nNO\u003c/pre\u003e"}}]}