{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eEven the most successful company can go through a crisis period when you have to make a hard decision — to restructure, discard and merge departments, fire employees and do other unpleasant stuff. Let\u0027s consider the following model of a company.\u003c/p\u003e\u003cp\u003eThere are \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e people working for the Large Software Company. Each person belongs to some \u003cspan class\u003d\"tex-font-style-it\"\u003edepartment\u003c/span\u003e. Initially, each person works on his own project in his own department (thus, each company initially consists of \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e departments, one person in each).\u003c/p\u003e\u003cp\u003eHowever, harsh times have come to the company and the management had to hire a crisis manager who would rebuild the working process in order to boost efficiency. Let\u0027s use \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eteam\u003c/i\u003e(\u003ci\u003eperson\u003c/i\u003e)\u003c/span\u003e to represent a team where person \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eperson\u003c/i\u003e\u003c/span\u003e works. A crisis manager can make decisions of two types:\u003c/p\u003e\u003col\u003e \u003cli\u003e Merge departments \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eteam\u003c/i\u003e(\u003ci\u003ex\u003c/i\u003e)\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eteam\u003c/i\u003e(\u003ci\u003ey\u003c/i\u003e)\u003c/span\u003e into one large department containing all the employees of \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eteam\u003c/i\u003e(\u003ci\u003ex\u003c/i\u003e)\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eteam\u003c/i\u003e(\u003ci\u003ey\u003c/i\u003e)\u003c/span\u003e, where \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ey\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003ex\u003c/i\u003e, \u003ci\u003ey\u003c/i\u003e ≤ \u003ci\u003en\u003c/i\u003e\u003c/span\u003e) — are numbers of two of some company employees. If \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eteam\u003c/i\u003e(\u003ci\u003ex\u003c/i\u003e)\u003c/span\u003e matches \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eteam\u003c/i\u003e(\u003ci\u003ey\u003c/i\u003e)\u003c/span\u003e, then nothing happens. \u003c/li\u003e\u003cli\u003e Merge departments \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eteam\u003c/i\u003e(\u003ci\u003ex\u003c/i\u003e), \u003ci\u003eteam\u003c/i\u003e(\u003ci\u003ex\u003c/i\u003e + 1), ..., \u003ci\u003eteam\u003c/i\u003e(\u003ci\u003ey\u003c/i\u003e)\u003c/span\u003e, where \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ey\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003ex\u003c/i\u003e ≤ \u003ci\u003ey\u003c/i\u003e ≤ \u003ci\u003en\u003c/i\u003e\u003c/span\u003e) — the numbers of some two employees of the company. \u003c/li\u003e\u003c/ol\u003e\u003cp\u003eAt that the crisis manager can sometimes wonder whether employees \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ey\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003ex\u003c/i\u003e, \u003ci\u003ey\u003c/i\u003e ≤ \u003ci\u003en\u003c/i\u003e\u003c/span\u003e) work at the same department.\u003c/p\u003e\u003cp\u003eHelp the crisis manager and answer all of his queries.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input contains two integers \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eq\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 200 000\u003c/span\u003e, \u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003eq\u003c/i\u003e ≤ 500 000\u003c/span\u003e) — the number of the employees of the company and the number of queries the crisis manager has.\u003c/p\u003e\u003cp\u003eNext \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eq\u003c/i\u003e\u003c/span\u003e lines contain the queries of the crisis manager. Each query looks like \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003etype\u003c/i\u003e\u0026nbsp;\u003ci\u003ex\u003c/i\u003e\u0026nbsp;\u003ci\u003ey\u003c/i\u003e\u003c/span\u003e, where \u003cimg align\u003d\"middle\" class\u003d\"tex-formula\" src\u003d\"CDN_BASE_URL/be6ae1d381fedd7a5147d3306bd0d665?v\u003d1714139939\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e. If \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003etype\u003c/i\u003e \u003d 1\u003c/span\u003e or \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003etype\u003c/i\u003e \u003d 2\u003c/span\u003e, then the query represents the decision of a crisis manager about merging departments of the first and second types respectively. If \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003etype\u003c/i\u003e \u003d 3\u003c/span\u003e, then your task is to determine whether employees \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ey\u003c/i\u003e\u003c/span\u003e work at the same department. Note that \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ex\u003c/i\u003e\u003c/span\u003e can be equal to \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ey\u003c/i\u003e\u003c/span\u003e in the query of any type.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each question of type \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e print \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e\" or \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\u003e\" (without the quotes), depending on whether the corresponding people work in the same department.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003e8 6\n3 2 5\n1 2 5\n3 2 5\n2 4 7\n2 1 2\n3 1 7\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNO\nYES\nYES\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}