Problem:
Score : 400 points

Problem Statement

Fennec and Snuke are playing a board game.

On the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeatedly traveling to an adjacent cell. In terms of graph theory, the graph formed by the cells and the roads is a tree.

Initially, Cell 1 is painted black, and Cell N is painted white. The other cells are not yet colored.
Fennec (who goes first) and Snuke (who goes second) alternately paint an uncolored cell.
More specifically, each player performs the following action in her/his turn:

Fennec: selects an uncolored cell that is adjacent to a black cell, and paints it black.

Snuke: selects an uncolored cell that is adjacent to a white cell, and paints it white.

A player loses when she/he cannot paint a cell. Determine the winner of the game when Fennec and Snuke play optimally.

Constraints

2 \leq N \leq 10^5

1 \leq a_i, b_i \leq N

The given 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

If Fennec wins, print Fennec; if Snuke wins, print Snuke.

Sample Input 1

7
3 6
1 2
3 1
7 4
5 7
1 4

Sample Output 1

Fennec

For example, if Fennec first paints Cell 2 black, she will win regardless of Snuke's moves.

Sample Input 2

4
1 4
4 2
2 3

Sample Output 2

Snuke

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

#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

#define INF 1e+9 //初期化注意
#define MAX_V 100000 //頂点数の最大値

struct edge {
	int to;
	int cost;
	//edge e ={to, cost}
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;// 頂点の数
vector<edge> G[MAX_V];
int d[MAX_V];



void dijkstra(int s) {
	//sからiへの最短距離をd[i]に保存 i=e.to
	priority_queue<P, vector<P>, greater<P> > que;
	fill(d, d + V, INF);
	d[s] = 0;//初期位置へのコストは0

	que.push(P(0, s));
	//queはmake_pair(cost,to)?

	while (!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;//v=e.to	from s to v
		//すでにこの経路よりいい経路が見つかっているなら無視
		if (d[v] < p.first) continue;
		

		for (int i = 0; i < G[v].size(); ++i) {
			edge e = G[v][i];
			// i 番目の v と v'を結ぶ辺　G=<e.to, e.cost>
			//e.to=v'
	                //e.cost means v to v' costs e.cost
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				//from s to v'> from s to v + from v to v'
				//vを経由したほうがコストが低いなら経由する
				que.push(P(d[e.to], e.to));
			}
		}
	}
}
int main() {
	cin >> V;
	int E=V-1;//辺の数
	for (int i = 0; i < E; ++i) {
		int a, b, c=1;
		cin >> a >> b ;
		a--; b--;
		//the route a to b costs c
		edge e = { b, c };
		G[a].push_back(e);
        edge e2={a,c};
        G[b].push_back(e2);
		//有効グラフの場合であり、無向グラフなら e{a,c}も必要
	}
	dijkstra(0);
    vector<int>d1(V-1),d2(V-1);
	//dijkstra(int s); nからの最短距離を計算
	//d[i]はsからiまでの最短距離が保存される the path from s to i costs d[i]
    rep(i,V-1){
        d1[i]=d[i];
    }
    dijkstra(V-1);
    rep(i,V-1){
        d2[i]=d[i];
    }
    vector<bool>iswhite(V-1,true);
    rep(i,V-1){
        if(d1[i]<=d2[i]){
            iswhite[i]=false;
        }
    }
    int white=0,black=0;
    rep(i,V-1){
        if(iswhite[i]){
            white++;
        }else{
            black++;
        }
    }
    if(white>black){
        cout<<"Snuke"<<endl;
    }else{
        cout<<"Fennec"<<endl;
    }
}