Language: C++

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define inf 1000000007LL

#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)

class Dinic {
public:
  vector<vector<pair<int, int>>> v;
  vector<int> e;

  vector<int> k;
  vector<int> j;

  void init(int n) {
    v = vector<vector<pair<int, int>>>(n);
    e = vector<int>();
    k = vector<int>(n);
    j = vector<int>(n);
  }
  void add_edge(int a, int b, int atob, int btoa = 0) {
    v[a].push_back(make_pair(b, e.size()));
    e.push_back(atob);
    v[b].push_back(make_pair(a, e.size()));
    e.push_back(btoa);
  }
  void dyk(int s) {
    for(auto& i : k) {
      i = inf;
    }
    queue<pair<int, int>> pq;
    pq.push(make_pair(0, s));
    while(!pq.empty()) {
      int w = pq.front().first;
      int b = pq.front().second;
      pq.pop();
      if(k[b] > w) {
        k[b] = w;
        for(auto i : v[b]) {
          if(e[i.second] > 0) {
            pq.push(make_pair(w + 1, i.first));
          }
        }
      }
    }
  }
  int dfs(int s, int t, int p, int c) {
    if(p == t) {
      return c;
    }
    int all = 0;
    while(c > all && j[p] < v[p].size()) {
      if(k[v[p][j[p]].first] == k[p] + 1) {
        int r = dfs(s, t, v[p][j[p]].first, min(c - all, e[v[p][j[p]].second]));
        e[v[p][j[p]].second] -= r;
        e[v[p][j[p]].second ^ 1] += r;
        if(r < c - all) {
          j[p]++;
        }
        all += r;
      }
      else {
        j[p]++;
      }
    }
    return all;
  }
  int solve(int s, int t) {
    int all = 0;
    while(1) {
      dyk(s);
      for(auto& i : j) {
        i = 0;
      }
      int r = dfs(s, t, s, inf);
      if(r == 0) {
        return all;
      }
      all += r;
    }
  }
};

class Rmq {
public:
  vector<int> d;
  int n;

  void init(int nw) {
    n = 1;
    while(n < nw) {
      n *= 2;
    }
    d.resize(n * 2);
    rep(i, n * 2) {
      d[i] = inf * inf;
    }
  }
  void set_(int b, int x, int p, int nb, int ne) {
    if(nb <= b && b < ne) {
      if(nb == ne - 1) {
        d[p] = min(d[p], x);
      }
      else {
        int m = (nb + ne) / 2;
        set_(b, x, p * 2 + 1, nb, m);
        set_(b, x, p * 2 + 2, m, ne);
        d[p] = min(d[p * 2 + 1], d[p * 2 + 2]);
      }
    }
  }
  void set(int b, int x) {
    set_(b, x, 0, 0, n);
  }
  int get_(int b, int e, int p, int nb, int ne) {
    if(b <= nb && ne <= e) {
      return d[p];
    }
    else if(ne <= b || e <= nb) {
      return inf * inf;
    }
    else {
      int m = (nb + ne) / 2;
      return min(get_(b, e, p * 2 + 1, nb, m), get_(b, e, p * 2 + 2, m, ne));
    }
  }
  int get(int b, int e) {
    return get_(b, e, 0, 0, n);
  }
};

vector<int> v[114514];

pair<pair<bool, bool>, pair<bool, bool>> dfs(int p, int o) {
  if(v[p].size() == 1) {
    return make_pair(make_pair(true, false), make_pair(false, false));
  }
  pair<pair<bool, bool>, pair<bool, bool>> r = make_pair(make_pair(false, false), make_pair(false, false));
  int k = 0;
  for(auto i : v[p]) {
    if(i != o) {
      auto w = dfs(i, p);
      if(w.first.first) {
        k++;
        r.first.second = true;
      }
      if(w.first.second) {
        r.first.first = true;
      }
      if(w.second.first) {
        r.second.second = true;
      }
      if(w.second.second) {
        r.second.first = true;
      }
    }
  }
  if(k >= 2 || (w.first.first && w.second.first) || (w.first.second && w.second.second)) {
    cout << "First" << endl;
    exit(0);
  }
  if(k == 1) {
    r.second.second = true;
  }
  return r;
}

signed main() {
  int n;
  cin >> n;
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    v[a - 1].push_back(b - 1);
    v[b - 1].push_back(a - 1);
  }
  dfs(0, -1);
  cout << "Second" << endl;
}


Compiler output:
a.cc: In function 'std::pair<std::pair<bool, bool>, std::pair<bool, bool> > dfs(long long int, long long int)':
a.cc:165:17: error: 'w' was not declared in this scope
  165 |   if(k >= 2 || (w.first.first && w.second.first) || (w.first.second && w.second.second)) {
      |                 ^