{"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\u003eSomeone give a strange birthday present to Ivan. It is hedgehog\u0026nbsp;— connected undirected graph in which one vertex has degree at least $$$3$$$ (we will call it center) and all other vertices has degree 1. Ivan thought that hedgehog is too boring and decided to make himself $$$k$$$-multihedgehog.\u003c/p\u003e\u003cp\u003eLet us define $$$k$$$-multihedgehog as follows:\u003c/p\u003e\u003cul\u003e\u003cli\u003e $$$1$$$-multihedgehog is hedgehog: it has one vertex of degree at least $$$3$$$ and some vertices of degree 1.\u003c/li\u003e\u003cli\u003e For all $$$k \\ge 2$$$, $$$k$$$-multihedgehog is $$$(k-1)$$$-multihedgehog in which the following changes has been made for each vertex $$$v$$$ with degree 1: let $$$u$$$ be its only neighbor; remove vertex $$$v$$$, create a new hedgehog with center at vertex $$$w$$$ and connect vertices $$$u$$$ and $$$w$$$ with an edge. New hedgehogs can differ from each other and the initial gift. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThereby $$$k$$$-multihedgehog is a tree. Ivan made $$$k$$$-multihedgehog but he is not sure that he did not make any mistakes. That is why he asked you to check if his tree is indeed $$$k$$$-multihedgehog.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eFirst line of input contains $$$2$$$ integers $$$n$$$, $$$k$$$ ($$$1 \\le n \\le 10^{5}$$$, $$$1 \\le k \\le 10^{9}$$$)\u0026nbsp;— number of vertices and hedgehog parameter.\u003c/p\u003e\u003cp\u003eNext $$$n-1$$$ lines contains two integers $$$u$$$ $$$v$$$ ($$$1 \\le u, \\,\\, v \\le n; \\,\\, u \\ne v$$$)\u0026nbsp;— indices of vertices connected by edge.\u003c/p\u003e\u003cp\u003eIt is guaranteed that given graph is a tree.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint \u003cspan class\u003d\"tex-font-style-tt\"\u003e\"Yes\"\u003c/span\u003e (without quotes), if given graph is $$$k$$$-multihedgehog, and \u003cspan class\u003d\"tex-font-style-tt\"\u003e\"No\"\u003c/span\u003e (without quotes) otherwise.\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\u003e14 2\n1 4\n2 4\n3 4\n4 13\n10 5\n11 5\n12 5\n14 5\n5 13\n6 7\n8 6\n13 6\n9 6\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYes\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\u003e3 1\n1 3\n2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNo\n\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\u003e2-multihedgehog from the first example looks like this:\u003c/p\u003e\u003cp\u003e\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/6a29369e6819847c86b621c9861515d8?v\u003d1715733483\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\u003c/p\u003e\u003cp\u003eIts center is vertex $$$13$$$. Hedgehogs created on last step are: [4 (center), 1, 2, 3], [6 (center), 7, 8, 9], [5 (center), 10, 11, 12, 13].\u003c/p\u003e\u003cp\u003eTree from second example is not a hedgehog because degree of center should be at least $$$3$$$.\u003c/p\u003e"}}]}