{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eTakahashi\u0027s office has \u003cvar\u003e\\(N\\)\u003c/var\u003e rooms. Each room has an ID from \u003cvar\u003e\\(1\\)\u003c/var\u003e to \u003cvar\u003e\\(N\\)\u003c/var\u003e.\r\nThere are also \u003cvar\u003e\\(N-1\\)\u003c/var\u003e corridors, and the \u003cvar\u003e\\(i\\)\u003c/var\u003e-th corridor connects Room \u003cvar\u003e\\(a_i\\)\u003c/var\u003e and Room \u003cvar\u003e\\(b_i\\)\u003c/var\u003e.\r\nIt is known that we can travel between any two rooms using only these corridors.\u003c/p\u003e\r\n\u003cp\u003eTakahashi has got lost in one of the rooms. Let this room be \u003cvar\u003e\\(r\\)\u003c/var\u003e.\r\nHe decides to get back to his room, Room \u003cvar\u003e\\(1\\)\u003c/var\u003e, by repeatedly traveling in the following manner:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eTravel to the room with the smallest ID among the rooms that are adjacent to the rooms already visited, but not visited yet.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eLet \u003cvar\u003e\\(c_r\\)\u003c/var\u003e be the number of travels required to get back to Room \u003cvar\u003e\\(1\\)\u003c/var\u003e.\r\nFind all of \u003cvar\u003e\\(c_2,c_3,...,c_N\\)\u003c/var\u003e.\r\nNote that, no matter how many corridors he passes through in a travel, it still counts as one travel.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(2 \\leq N \\leq 2\\times 10^5\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq a_i,b_i \\leq N\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(a_i \\neq b_i\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eThe graph given as input is a tree.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(a_1\\)\u003c/var\u003e \u003cvar\u003e\\(b_1\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(:\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(a_{N-1}\\)\u003c/var\u003e \u003cvar\u003e\\(b_{N-1}\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint \u003cvar\u003e\\(c_r\\)\u003c/var\u003e for each \u003cvar\u003e\\(r\\)\u003c/var\u003e, in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(c_2\\)\u003c/var\u003e \u003cvar\u003e\\(c_3\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(c_N\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","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\u003e6\r\n1 5\r\n5 6\r\n6 2\r\n6 3\r\n6 4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5 5 5 1 5\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eFor example, if Takahashi was lost in Room \u003cvar\u003e\\(2\\)\u003c/var\u003e, he will travel as follows:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eTravel to Room \u003cvar\u003e\\(6\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eTravel to Room \u003cvar\u003e\\(3\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eTravel to Room \u003cvar\u003e\\(4\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eTravel to Room \u003cvar\u003e\\(5\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eTravel to Room \u003cvar\u003e\\(1\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","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\u003e6\r\n1 2\r\n2 3\r\n3 4\r\n4 5\r\n5 6\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 2 3 4 5\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 3","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\u003e10\r\n1 5\r\n5 6\r\n6 10\r\n6 4\r\n10 3\r\n10 8\r\n8 2\r\n4 7\r\n4 9\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e7 5 3 1 3 4 7 4 5\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\u003c/section\u003e\r\n"}}]}