Problem:
Score : 900 points

Problem Statement

There is a tree with N vertices numbered 1 through N.
The i-th of the N-1 edges connects vertices a_i and b_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

2 ≤ N ≤ 10^5

1 ≤ a_i,b_i ≤ N

a_i ≠ b_i

The input graph is a tree.

Input

Input is given from Standard Input in the following format:

N
a_1 b_1
:
a_{N-1} b_{N-1}

Output

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

Sample Input 1

3
1 2
2 3

Sample Output 1

First

Below is a possible progress of the game:

First, Takahashi paint vertex 2 white.

Then, Aoki paint vertex 1 black.

Lastly, Takahashi paint vertex 3 white.

In this case, the colors of vertices 1, 2 and 3 after the final procedure are black, black and white, resulting in Takahashi's victory.

Sample Input 2

4
1 2
2 3
2 4

Sample Output 2

First

Sample Input 3

6
1 2
2 3
3 4
2 5
5 6

Sample Output 3

Second

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define Inf 10000000000ll
#define ll long long
using namespace std;


vector<int> edges[111111];

map<pair<int,int>,bool> hashed;

bool GetBool(int nc,int ne) {
    bool retval=false;
    if (ne == 0)
        retval=true;
    else
        retval |= (nc>=2);
    return retval;
}

int ncs[111111];

bool CanWin(int par, int u) {
    
    if (hashed.find(make_pair(par,u)) != hashed.end())
        return hashed[make_pair(par,u)];
    
    if (par != -1 && ncs[u]!=-1 && hashed.find(make_pair(u,par)) != hashed.end())
        return GetBool(ncs[u]-hashed[make_pair(u,par)], edges[u].size()-1);
    
    
    int nc=0;
    int ne=0;
    for(int j=0;j<edges[u].size();j++) {
        int v=edges[u][j];
        if (v == par)
            continue;
        ne++;
        nc += (int)CanWin(u,v);
    }
    
    if (par == -1)
        ncs[u]=nc;
    
    return hashed[make_pair(par,u)]=GetBool(nc,ne);

    
}


int main() {
    int N;
    cin>>N;
    for(int i=1;i<=N-1;i++) {
        int u,v;
        cin>>u>>v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    
    vector<pair<int,int> > deg_verts;
    for(int i=1;i<=N;i++) {
        deg_verts.push_back(make_pair(edges[i].size(),i));
        ncs[i]=-1;
    }
    
    sort(deg_verts.begin(),deg_verts.end());
    
    bool can=false;
    for(int j=deg_verts.size()-1;j>=0;j--) {
        int u=deg_verts[j].second;
        if (CanWin(-1,u)) {
            can=true;
            break;
        }
    }
    
    if (can) {
        printf("First\n");
    } else {
        printf("Second\n");
    }
    
    
}