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: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var sr = new InputReader(Console.In))
            //using (var sr = new InputReader(new StreamReader("input.txt")))
            {
                var task = new Task();
                using (var sw = Console.Out) {
                    //using (var sw = new StreamWriter("output.txt")) {
                    task.Solve(sr, sw);
                    //Console.ReadKey();
                }
            }
        }
    }

    internal class Task
    {
        public void Solve(InputReader sr, TextWriter sw)
        {
            var n = sr.NextInt32();
            var graph = new Graph(n);
            for (var i = 0; i < n - 1; i++) {
                var input = sr.ReadArrayOfInt32();
                graph.Insert(input[0] - 1, input[1] - 1);
            }
            sw.WriteLine(graph.Solution());
        }
    }

    class Graph
    {
        private readonly List<int>[] edges;
        private readonly Color[] colors;

        public Graph(int n)
        {
            edges = new List<int>[n];
            colors = new Color[n];
        }

        public void Insert(int x, int y)
        {
            if (edges[x] == null) {
                edges[x] = new List<int>();
            }
            edges[x].Add(y);
            if (edges[y] == null) {
                edges[y] = new List<int>();
            }
            edges[y].Add(x);
        }

        public string Solution()
        {
            var path = new List<int>();
            var visited = new bool[edges.Length];
            DfsVisit(0, visited, path);
            path.RemoveAt(0);
            var fennecSteps = path.Count % 2 == 1 ? (path.Count + 1) / 2 : path.Count;
            var snukeSteps = path.Count % 2 == 1 ? (path.Count - 1) / 2 : path.Count;
            visited = new bool[edges.Length];
            foreach (var v in path) {
                visited[v] = true;
            }
            visited[0] = true;
            visited[edges.Length - 1] = true;
            fennecSteps += DfsVisit(0, visited, 0);
            snukeSteps += DfsVisit(edges.Length - 1, visited, 0);

            if (fennecSteps >= snukeSteps) {
                return "Fennec";
            }
            return "Snuke";
        }

        private int DfsVisit(int v, bool[] visited, int curr)
        {
            visited[v] = true;
            var result = curr;
            for (var i = 0; i < edges[v].Count; i++) {
                if (!visited[edges[v][i]]) {
                    var next = DfsVisit(edges[v][i], visited, curr + 1);
                    result += (next - curr);
                }
            }

            return result;
        }

        private bool DfsVisit(int v, bool[] visited, List<int> path)
        {
            if (v == edges.Length - 1)
                return true;
            visited[v] = true;
            path.Add(v);
            for (var i = 0; i < edges[v].Count; i++) {
                if (!visited[edges[v][i]]) {
                    if (DfsVisit(edges[v][i], visited, path)) {
                        return true;
                    }
                }
            }
            path.RemoveAt(path.Count - 1);
            return false;
        }
    }

    enum Color
    {
        None,
        White,
        Black
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(NextString());
    }

    public long NextInt64()
    {
        return Int64.Parse(NextString());
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose) {
            if (dispose)
                sr.Close();
            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}