atcoder#AGC014D. [AGC014D] Black and White Tree

[AGC014D] Black and White Tree

Score : 900900 points

Problem Statement

There is a tree with NN vertices numbered 11 through NN. The ii-th of the N1N-1 edges connects vertices aia_i and bib_i.

Initially, each vertex is uncolored.

Takahashi and Aoki is playing a game by painting the vertices. In this game, they alternately perform the following operation, starting from Takahashi:

  • Select a vertex that is not painted yet.
  • If it is Takahashi who is performing this operation, paint the vertex white; paint it black if it is Aoki.

Then, after all the vertices are colored, the following procedure takes place:

  • Repaint every white vertex that is adjacent to a black vertex, in black.

Note that all such white vertices are repainted simultaneously, not one at a time.

If there are still one or more white vertices remaining, Takahashi wins; if all the vertices are now black, Aoki wins. Determine the winner of the game, assuming that both persons play optimally.

Constraints

  • 2N1052 \leq N \leq 10^5
  • 1ai,biN1 \leq a_i,b_i \leq N
  • aibia_i \neq b_i
  • The input graph is a tree.

Input

Input is given from Standard Input in the following format:

NN

a1a_1 b1b_1

:

aN1a_{N-1} bN1b_{N-1}

Output

Print First if Takahashi wins; print Second if Aoki wins.

3
1 2
2 3
First

Below is a possible progress of the game:

  • First, Takahashi paint vertex 22 white.
  • Then, Aoki paint vertex 11 black.
  • Lastly, Takahashi paint vertex 33 white.

In this case, the colors of vertices 11, 22 and 33 after the final procedure are black, black and white, resulting in Takahashi's victory.

4
1 2
2 3
2 4
First
6
1 2
2 3
3 4
2 5
5 6
Second