Erikire has a strange name and a strange obsession. He tries to maintain symmetry in…
- User
Erikire has a strange name and a strange obsession. He tries to maintain symmetry in every aspect of his life, whether by wearing bangs and a ponytail, never sleeping on his side, or using two forks when eating. Erikire really likes the new passenger trains, as they not only have doors on both sides of the carriages (unlike buses), but also a traction set at either end of the train (unlike express trains). Erikire travels everywhere by passenger train, and is eager to plot his preferred routes (which have exactly the same number of trees on both sides of the track) schematically on a plan map. This map must, of course, satisfy a certain property. Problem
The routes that Erikire travels on are made up of cities and the tracks that connect them. Together they form a continuous acyclic graph. Erikire is very eager to draw a schematic route map of them. This one should have his residence at the top and all the other towns somewhere below. The tracks that connect the cities must not cross, and the map must of course be symmetrical. Please find out whether or not this can be done, let Erikire finally stop talking about it. Entry and Exit
The first line contains the number N
- The number of places (1≤N≤10^5). The following are the N lines. The i-th line contains ki+1 space-separated numbers. The first number will be ki, which indicates the number of neighbors of vertex i. The remaining ki
numbers are the numbers of vertices of its neighbors. Eirike's house always has the number 0 and we index from 0.
Write out one line of text yeey if the desired map can be drawn, otherwise noo.
- Assistant