Language: C++

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int N;
vector<int> Tree[100005];
int DP[100005][100005];
queue<int> q1, q2;
unordered_map<int, bool> S;
// idxの偶奇で先手後手判断する
// どのようにとっても自分が負けるならtrueを返す。相手は必ずそれを打つ
// そうでない場合はfalseを返す
bool dfs(int idx, int prevB, int prevW, queue<int> B, queue<int> W, unordered_map<int, bool> S) {
  if (idx==N-1) return true; // 最後までいったならその前の人は勝つ
  if (DP[prevB][prevW]>=0) return DP[prevB][prevW];
  S[prevB] = true;
  S[prevW] = true;
  bool flag = true;
  if (idx%2==0) {
    vector<int> vec = Tree[prevB];
    for(auto p : Tree[prevB]) {
      if (!S[p]) B.push(p);
    }
    int queSize = B.size();
    rep(i, queSize) {
      int q = B.front(); B.pop();
      bool tmp = dfs(idx+1, q, prevW, B, W, S);
      if (tmp) {
        flag = false;
        break;
      }
      B.push(q);
    }
  } else {
    vector<int> vec = Tree[prevW];
    for(auto p : Tree[prevW]) {
      if (!S[p]) W.push(p);
    }
    int queSize = W.size();
    rep(i, queSize) {
      int q = W.front(); W.pop();
      bool tmp = dfs(idx+1, prevB, q, B, W, S);
      if (tmp) {
        flag = false;
        break;
      }
      W.push(q);
    }
  }
  DP[prevB][prevW] = !flag?1:0;
  return flag;
}

int main() {
  INCANT;
  cin >> N;
  int a,b;
  rep(i, N-1) {
    cin >> a >> b;
    a--;b--;
    Tree[a].push_back(b);
    Tree[b].push_back(a);
  }
  rep(i, N) rep(j, N) DP[i][j] = -1;
  bool c = dfs(0, 0, N-1, q1, q2, S);
  string ans = !c?"Fennec":"Snuke"; //-1番目の人の勝敗
  cout << ans << "\n";
  return 0;
}

Compiler output:
/tmp/ccr1rEVy.o: in function `main':
a.cc:(.text+0x834): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccr1rEVy.o
a.cc:(.text+0x84d): relocation truncated to fit: R_X86_64_PC32 against symbol `q2' defined in .bss section in /tmp/ccr1rEVy.o
a.cc:(.text+0x863): relocation truncated to fit: R_X86_64_PC32 against symbol `q1' defined in .bss section in /tmp/ccr1rEVy.o
/tmp/ccr1rEVy.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0xa5d): relocation truncated to fit: R_X86_64_PC32 against symbol `q1' defined in .bss section in /tmp/ccr1rEVy.o
a.cc:(.text+0xa76): relocation truncated to fit: R_X86_64_PC32 against symbol `q1' defined in .bss section in /tmp/ccr1rEVy.o
a.cc:(.text+0xa8f): relocation truncated to fit: R_X86_64_PC32 against symbol `q2' defined in .bss section in /tmp/ccr1rEVy.o
a.cc:(.text+0xaa8): relocation truncated to fit: R_X86_64_PC32 against symbol `q2' defined in .bss section in /tmp/ccr1rEVy.o
a.cc:(.text+0xac1): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccr1rEVy.o
a.cc:(.text+0xada): relocation truncated to fit: R_X86_64_PC32 against symbol `S' defined in .bss section in /tmp/ccr1rEVy.o
collect2: error: ld returned 1 exit status