{"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\u003cspan class\u003d\"tex-font-style-it\"\u003eThis is an interactive problem.\u003c/span\u003e\u003c/p\u003e\u003cp\u003eYou\u0027re given a tree consisting of $$$n$$$ nodes, rooted at node $$$1$$$. A tree is a connected graph with no cycles.\u003c/p\u003e\u003cp\u003eWe chose a hidden node $$$x$$$. In order to find this node, you can ask queries of two types: \u003c/p\u003e\u003cul\u003e \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ed\u003c/span\u003e $$$u$$$ ($$$1 \\le u \\le n$$$). We will answer with the distance between nodes $$$u$$$ and $$$x$$$. The distance between two nodes is the number of edges in the shortest path between them. \u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003es\u003c/span\u003e $$$u$$$ ($$$1 \\le u \\le n$$$). We will answer with the second node on the path from $$$u$$$ to $$$x$$$. However, there\u0027s a plot twist. If $$$u$$$ is \u003cspan class\u003d\"tex-font-style-bf\"\u003enot\u003c/span\u003e an ancestor of $$$x$$$, you\u0027ll receive \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eWrong answer\u003c/span\u003e\" verdict! \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eNode $$$a$$$ is called an ancestor of node $$$b$$$ if $$$a \\ne b$$$ and the shortest path from node $$$1$$$ to node $$$b$$$ passes through node $$$a$$$. \u003cspan class\u003d\"tex-font-style-bf\"\u003eNote that in this problem a node is not an ancestor of itself\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eCan you find $$$x$$$ in no more than $$$36$$$ queries? The hidden node is fixed in each test beforehand and does not depend on your queries.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains the integer $$$n$$$ ($$$2 \\le n \\le 2 \\cdot 10^5$$$)\u0026nbsp;— the number of nodes in the tree.\u003c/p\u003e\u003cp\u003eEach of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \\le u,v \\le n$$$) that mean there\u0027s an edge between nodes $$$u$$$ and $$$v$$$. It\u0027s guaranteed that the given graph is a tree.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eTo print the answer, print \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e! x\u003c/span\u003e\" (without quotes).\u003c/p\u003e"}},{"title":"Interaction","value":{"format":"HTML","content":"\u003cp\u003eTo ask a question, print it in one of the formats above: \u003c/p\u003e\u003cul\u003e \u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003ed\u003c/span\u003e $$$u$$$ ($$$1 \\le u \\le n$$$), or \u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003es\u003c/span\u003e $$$u$$$ ($$$1 \\le u \\le n$$$). \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eAfter each question, you should read the answer: either the distance or the second vertex on the path, as mentioned in the legend. \u003c/p\u003e\u003cp\u003eIf we answer with $$$-1$$$ instead of a valid answer, that means you exceeded the number of queries, made an invalid query, or violated the condition in the second type of queries. Exit immediately after receiving $$$-1$$$ and you will see \u003cspan class\u003d\"tex-font-style-tt\"\u003eWrong answer\u003c/span\u003e verdict. Otherwise, you can get an arbitrary verdict because your solution will continue to read from a closed stream.\u003c/p\u003e\u003cp\u003eAfter printing a query, do not forget to output end of line and flush the output. Otherwise, you will get \u003cspan class\u003d\"tex-font-style-tt\"\u003eIdleness limit exceeded\u003c/span\u003e. To do this, use:\u003c/p\u003e\u003cul\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003efflush(stdout)\u003c/span\u003e or \u003cspan class\u003d\"tex-font-style-tt\"\u003ecout.flush()\u003c/span\u003e in C++;\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003eSystem.out.flush()\u003c/span\u003e in Java;\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003eflush(output)\u003c/span\u003e in Pascal;\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003estdout.flush()\u003c/span\u003e in Python;\u003c/li\u003e\u003cli\u003e See the documentation for other languages.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003eHacks:\u003c/span\u003e\u003c/p\u003e\u003cp\u003eThe first line should contain two integers $$$n$$$ and $$$x$$$ ($$$2 \\le n \\le 2 \\cdot 10^5$$$, $$$1 \\le x \\le n$$$).\u003c/p\u003e\u003cp\u003eEach of the next $$$n-1$$$ lines should contain two integers $$$u$$$ and $$$v$$$ ($$$1 \\le u,v \\le n$$$) that mean there is an edge between nodes $$$u$$$ and $$$v$$$. The edges must form a tree.\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\u003e5\n1 2\n1 3\n3 4\n3 5\n3\n5\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003ed 2\ns 3\n! 5\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first example, the hidden node is node $$$5$$$.\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/6bd16bfec70f2d58c5dbbda5929b456c?v\u003d1725621831\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e\u003cp\u003eWe first ask about the distance between node $$$x$$$ and node $$$2$$$. The answer is $$$3$$$, so node $$$x$$$ is either $$$4$$$ or $$$5$$$. We then ask about the second node in the path from node $$$3$$$ to node $$$x$$$. Note here that node $$$3$$$ is an ancestor of node $$$5$$$. We receive node $$$5$$$ as the answer. Finally, we report that the hidden node is node $$$5$$$.\u003c/p\u003e"}}]}