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 (GCC 5.4.1) (judge verdict: Accepted)

//tree sample template
#include<stdio.h>
#include<stdlib.h>

typedef struct{
    long long st;
    long long fi;
}rs;

typedef struct{
    long long st;
    long long kz;
}mkj;

int sortfnc(const void *a,const void *b){
if(((rs*)a)->st == ((rs*)b)->st){return 0;}
if(((rs*)a)->st < ((rs*)b)->st){return -1;}
return 1;
}

void makemkj(rs g[],mkj x[],long long n){
    long long i,ms=0,nst=g[0].st;
    for(i=1;i<n;i++){
        if(g[i].st!=g[i-1].st){
            x[nst].kz=i-ms;
            x[nst].st=ms;
            nst=g[i].st;ms=i;
        }
    }
    x[nst].kz=n-ms;
    x[nst].st=ms;
}

typedef struct{
long long node;
long long dist;
}qdt;

qdt q[16777216];
long long qp=0,qqp=0;

void qpush(qdt x){
    qp++;q[qp]=x;
}

qdt qpop(){
    qqp++;
    return q[qqp];
}

int main(void){
    long long n,a[131072],b[131072],i,wd[131072],bd[131072];
    long long f=0,s=0;
    rs g[262144];
    mkj x[131072];
    qdt sd,nsd;
    for(i=0;i<131072;i++){
        wd[i]=-1;bd[i]=-1;
    }
    scanf("%lld",&n);
    for(i=0;i<n-1;i++){
        scanf("%lld%lld",&a[i],&b[i]);
        g[2*i].st=a[i];g[2*i].fi=b[i];
        g[2*i+1].st=b[i];g[2*i+1].fi=a[i];
    }
    qsort(g,2*n,sizeof(rs),sortfnc);
    makemkj(g,x,2*n);
    sd.node=1;sd.dist=0;
    wd[1]=0;
    qpush(sd);
    while(qp-qqp){
        sd=qpop();
        wd[sd.node]=sd.dist;
        for(i=x[sd.node].st;i<x[sd.node].st+x[sd.node].kz;i++){
            if(wd[g[i].fi]!=-1){continue;}
            nsd.node=g[i].fi;
            nsd.dist=sd.dist+1;
            qpush(nsd);
        }
    }
    sd.node=n;sd.dist=0;
    bd[n]=0;
    qpush(sd);
    while(qp-qqp){
        sd=qpop();
        bd[sd.node]=sd.dist;
        for(i=x[sd.node].st;i<x[sd.node].st+x[sd.node].kz;i++){
            if(bd[g[i].fi]!=-1){continue;}
            nsd.node=g[i].fi;
            nsd.dist=sd.dist+1;
            qpush(nsd);
        }
    }
    for(i=1;i<=n;i++){
        if(wd[i]<=bd[i]){f++;}else{s++;}
    }
    if(f>s){printf("Fennec\n");}else{printf("Snuke\n");}
    return 0;
}