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 <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

class pcompare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return !(get<1>(a) < get<1>(b));
	}
};

int main() {
	int n, in1, in2;
	cin >> n;
	vvi vv(n);
	rep(i, n - 1) {
		cin >> in1 >> in2;
		in1--; in2--;
		vv[in1].push_back(in2);
		vv[in2].push_back(in1);
	}
	queue<pii> f, s;
	vi c(n, 0);
	c[0] = 1; c[n - 1] = -1;
	rep(i, vv[0].size())f.push(pii(vv[0][i],0));
	rep(i, vv[n-1].size())s.push(pii(vv[n-1][i],0));
	rep(i, n-1) {
		bool sw = false;
		while (!f.empty()&&f.front().sc == i) {
			rep(j, vv[f.front().fs].size()) {
				if (c[f.front().fs] == 0) {
					f.push(pii(vv[f.front().fs][j], i + 1));
					sw = true;
				}
			}
			c[f.front().fs] = 1;
			f.pop();
		}
		while (!s.empty()&&s.front().sc == i) {
			rep(j, vv[s.front().fs].size()) {
				if (c[s.front().fs] == 0){
					s.push(pii(vv[s.front().fs][j], i + 1));
					sw = true;
				}
			}
			c[s.front().fs] = -11;
			s.pop();
		}
		if (!sw)break;
	}
	queue<int> fe, su;
	fe.push(0);	su.push(0);
	c[0] = 2;
	ll cnt = 1;
	while (!fe.empty()) {
		//cout << fe.front() + 1 <<" ";
		rep(i, vv[fe.front()].size()) {
			if (c[vv[fe.front()][i]] == 1) {
				fe.push(vv[fe.front()][i]);
				c[fe.front()] = 2;
				//cout << vv[fe.front()][i]+1 << endl;
				cnt++;
			}
		}
		fe.pop();
		//cnt++;
	}
	//cout << cnt << endl;
	cout << (!(cnt * 2 <= n )? "Fennec" : "Snuke") << endl;
	

}