{"trustable":false,"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":"statement","value":{"format":"HTML","content":"Given you a classic tree, the tree have $N$ node and $N-1$ edge. \u003cbr\u003e\u003cbr\u003e\n\nEach point can be colored black, white, or left uncolored. and there have two rule : \u003cbr\u003e\n1 : The node in same edge can not have different color. \u003cbr\u003e\n2 : The node in same edge can have one left uncolored node and one colored node.\u003cbr\u003e\n\u003cbr\u003e\nLet $(a, b)$ represent a configuration where $a$ points are colored white and $b$ points are colored black. The goal is to find all $(a, b)$ configurations that maximize the sum $a + b$.\n\u003cbr\u003e\u003cbr\u003e\n*And you need at least one node black, one node white."}},{"title":"input","value":{"format":"HTML","content":"First input line contains integer $N(3 \\leq n \\leq 5000)$ — the number of tree\u0027s node. $\\\\$ \nThe follow $n - 1$ lines list all edge one per line. $\\\\$\nEach edge have $x_i y_i (1 \\leq x_i, y_i \\leq n)$ — the indexes of connected edge.\n\nIt is guaranteed that the given tree is represented by an undirected tree with $n$ vertexes."}},{"title":"output","value":{"format":"HTML","content":"Print on the first line integer $num$ — the number of all answer.\nThen print all pairs $(a, b)$ in the order of increasing of the first component $a$."}},{"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\u003e5\n1 2\n2 3\n3 4\n4 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n1 3\n2 2\n3 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\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\u003e10\n1 2\n2 3\n3 4\n5 6\n6 7\n7 4\n8 9\n9 10\n10 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\n1 8\n2 7\n3 6\n6 3\n7 2\n8 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}