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# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
namespace AtCoder {
    class MainClass {
        public static void Main(string[] args) { new MainClass().solve(); }
        Scanner cin;

        int N;
        int[] a,b;
        void solve() {
            cin = new Scanner();

            N = cin.nextInt();
            a = new int[N-1];
            b = new int[N-1];

            for(int i = 0; i < N - 1; i++) {
                a[i] = cin.nextInt();
                b[i] = cin.nextInt();
                a[i]--;
                b[i]--;
            }

            WarshallFloyd wf = new WarshallFloyd();
            int[,] dis = wf.Init(N);

            for(int i = 0; i < N - 1; i++) {
                dis[a[i], b[i]] = dis[b[i], a[i]] = 1;
            }

            dis = wf.Run(dis);

            int fMax = 0;
            int sMax = 0;

            for(int i = 0; i < N; i++) {
                fMax = Math.Max(fMax,dis[0, i]);
                sMax = Math.Max(sMax, dis[N - 1, i]);
            }

            Console.WriteLine(fMax <= sMax ? "Fennec" : "Snuke");

        }
    }

    class Scanner {
        string[] nextBuffer; int BufferCnt; char[] cs = new char[] { ' ' };
        public Scanner() { nextBuffer = new string[0]; BufferCnt = 0; }
        public string next() {
            if (BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            BufferCnt = 0;
            return nextBuffer[BufferCnt++];
        }
        public int nextInt() { return int.Parse(next()); }
        public long nextLong() { return long.Parse(next()); }
        public double nextDouble() { return double.Parse(next()); }
    }
    class WarshallFloyd {
        int INF;
        public WarshallFloyd() {
            INF = (int)(1e8);
        }
        public WarshallFloyd(int INF) {
            this.INF = INF;
        }

        /// <summary>
        /// 最短経路を見つける。O(辺の長さ^3)
        /// </summary>
        /// <param name="m">存在しない経路をINFで初期化した二次元配列</param>
        /// <returns></returns>
        public int[,] Run(int[,] m) {
            int edgeLength = m.GetLength(0);
            for (int i = 0; i < edgeLength; i++)
                for (int j = 0; j < edgeLength; j++)
                    for (int k = 0; k < edgeLength; k++)
                        m[j, k] = Math.Min(m[j, k], m[j, i] + m[i, k]);
            return m;
        }
        /// <summary>
        /// 経路の存在しないところをINF、自分自身を0とした二次元配列を生成。
        /// </summary>
        /// <param name="n">辺の長さ</param>
        /// <returns></returns>
        public int[,] Init(int n) {
            int[,] m = new int[n, n];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                    m[i, j] = INF;
            for (int i = 0; i < n; i++)
                m[i, i] = 0;
            return m;
        }
    }
}