stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define N 333333

#define rev(a) reverse(a+1,a+n+1)

#define ll long long

 

int n,t,a[N];

long long s[N],l[N],r[N],f[N],g[N],h[N],q[N];

int read(){

	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());

	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;

}

ll sum(int n){return (ll)n*(n+1)/2;} 

double slope(int x,int y){return (double)(g[x]-g[y])/(x-y);}

void pop(int x){for (;t>1&&slope(q[t-1],q[t])<=x;t--);}

void push(int x){

	for (;t>1&&slope(q[t-1],q[t])<=slope(q[t],x);t--);q[++t]=x;

}

void init_s(){for (int i=1;i<=n;i++) s[i]=s[i-1]+a[i];}

void calc(ll *f){

	int i;q[t=1]=0;init_s();

	for (i=1;i<=n;i++){

		pop(i);f[i]=max(f[i-1],f[q[t]]+sum(i-q[t])-s[i]+s[q[t]]);

		g[i]=f[i]+sum(i-1)+s[i];push(i);

	}

}

 

void solve(int x,int y){

	if (x==y) return;

	int mid=(x+y)/2;t=0;

	for (int i=x;i<=mid;i++){

		g[i]=l[i]+1ll*i*(i-1)/2+s[i];

		push(i);

	}

	for (int i=mid+1;i<=y;i++){

		pop(i);

		h[i]=l[q[t]]+r[i+1]+sum(i-q[t])-s[i]+s[q[t]];

	}

	for (int i=y-1;i>mid;i--) h[i]=max(h[i],h[i+1]);

	for (int i=mid+1;i<=y;i++) f[i]=max(f[i],h[i]);

	solve(x,mid);solve(mid+1,y);

}

 

int main(){

	n=read();

	for (int i=1;i<=n;i++) a[i]=read(),f[i]=-1e18;

	calc(l);rev(a);calc(r);rev(a);rev(r);

	init_s();solve(0,n);rev(a);rev(f);rev(l);rev(r);swap(l,r);

	init_s();solve(0,n);rev(a);rev(f);rev(l);rev(r);swap(l,r);

	for (int m=read();m;m--){

		int p=read(),x=read();

		printf("%lld\n",max(l[p-1]+r[p+1],a[p]+f[p]-x));

	}

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

#define ll long long

#define rev(a) reverse(a+1,a+n+1)

using namespace std;

const int N=3e5+5,inf=1e9;

int n,i,a[N];

ll s[N],g[N],l[N],r[N],f[N];

int read(){

	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());

	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;

}

void write(ll x){if (x>9) write(x/10);putchar(x%10+48);}

ll sum(int n){return (ll)n*(n+1)/2;}

int t,q[N];

double cal(int x,int y){return (double)(g[x]-g[y])/(x-y);}

void pop(int x){for (;t>1&&cal(q[t-1],q[t])<=x;t--);}

void push(int x){

	for (;t>1&&cal(q[t-1],q[t])<=cal(q[t],x);t--);q[++t]=x;

}

void init_s(){for (int i=1;i<=n;i++) s[i]=s[i-1]+a[i];}

void init(ll *f){

	int i;q[t=1]=0;init_s();

	for (i=1;i<=n;i++){

		pop(i);f[i]=max(f[i-1],f[q[t]]+sum(i-q[t])-s[i]+s[q[t]]);

		g[i]=f[i]+sum(i-1)+s[i];push(i);

	}

}

ll w[N];

void work(int x,int y){

	if (x==y) return;int i,m=x+y>>1;t=0;

	for (i=x;i<=m;i++) g[i]=l[i]+sum(i-1)+s[i],push(i);

	for (;i<=y;i++) pop(i),

		w[i]=l[q[t]]+r[i+1]+sum(i-q[t])-s[i]+s[q[t]];

	for (f[y]=max(f[y],w[y]),i=y-1;i>m;i--)

		f[i]=max(f[i],w[i]=max(w[i],w[i+1]));

	work(x,m);work(m+1,y);

}

int main(){

	for (n=read(),i=1;i<=n;i++) a[i]=read(),f[i]=-inf;

	init(l);rev(a);init(r);rev(a);rev(r);

	init_s();work(0,n);rev(a);rev(f);rev(l);rev(r);swap(l,r);

	init_s();work(0,n);rev(a);rev(f);rev(l);rev(r);swap(l,r);

	for (i=read();i--;putchar('\n')){

		int x=read(),k=read();

		write(max(l[x-1]+r[x+1],f[x]+a[x]-k));

	}	

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <string>

#include <algorithm>

#include <stdio.h>

#include <cmath>

using namespace std;



int to_int(string s){

    int number = 0;

    for(int i=0;i<s.size();i++){

        number *= 10;

        number += s[i] - '0';

    }

    return number;

}



string to_str(int n){

    string s;

    while(n!=0){

        s += n % 10 + 48;

        n /= 10;

    }

    reverse(s.begin(),s.end());

    return s;

}



bool isLeapYear(int year)

{

    if(((year % 4 == 0 ) && (year % 100 != 0)) || (year % 400 == 0))

        return true;

    else

        return false;

}



bool isPrime(int n)

{

    if (n == 2)

        return true;

    if ((n & 1)==0)

        return false;

    for (int i = 3; i*i <= n;i+=2) {

        if (n%i == 0)

            return false;

    }



    return true;

}



/*#define row 5001

#define col 10000



int arr[row][col];



void fib()

{

    arr[0][0] = 0;

    arr[1][0] = 1;

    for(int i=2;i<row;i++){

        for(int j=0;j<col;j++){

            if(arr[i-1][j] + arr[i-2][j] == 0)

                continue;

            arr[i][j] += arr[i-1][j] + arr[i-2][j];

            if(arr[i][j] > 9){

                arr[i][j+1] = arr[i][j]/10;

                arr[i][j] %= 10;

            }

        }

    }

}*/



int main()

{

    int a, b, c;

    cin >> a >> b >> c;

    if((b-a) == (c-b))

        cout << "YES" << endl;

    else

        cout << "NO" << endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int a,b,c;

	scanf ("%d %d %d",&a,&b,&c);

	if (b-a==c-b)

	{

		printf ("YES\n");

	}

	else printf ("NO\n");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;



int main ()

{

    int a, b, c;



    cin>>a>>b>>c;



    if (b-a==c-b)

    {

        cout<<"YES";

    }

    else

    {

        cout<<"NO";

    }

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	int a,b,c;

	scanf ("%d %d %d",&a,&b,&c);

	if (b-a==c-b)

	{

		printf ("YES\n");

	}

	else printf ("NO\n");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//程序名:新的C++程序

//作者: 



#include<iostream>

#include<fstream>

#include<algorithm>



using namespace std;

int main()

{

     int a,b,c;

	 cin>>a>>b>>c;

	 if(b-a==c-b) cout<<"YES";

	 else cout<<"NO";



    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

int a,b,c;

int main ()

{

	scanf ("%d %d %d",&a,&b,&c);

	printf ("%s\n",b-a==c-b?"YES":"NO");

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;



int main(){

  int a,b,c;

  cin>>a>>b>>c;

  cout<<(b-a==c-b?"YES":"NO");

  return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

int a,b,c;

int main ()

{

	scanf ("%d %d %d",&a,&b,&c);

	printf ("%s\n",b-a==c-b?"YES":"NO");

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int a,b,c;

	cin>>a>>b>>c;

	if(b-a==c-b) cout<<"YES"<<endl;

	else cout<<"NO"<<endl;

	

    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

int a,b,c;

int main ()

{

	scanf ("%d %d %d",&a,&b,&c);

	printf ("%s\n",b-a==c-b?"YES":"NO");

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a , b , c;

    cin >> a >> b >> c;

    if(a - b == b - c) cout << "YES";

    else cout << "NO";

    cout << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

int a,b,c;

int main ()

{

	scanf ("%d %d %d",&a,&b,&c);

	printf ("%s\n",b-a==c-b?"YES":"NO");

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){

    int a,b,c;

    cin>>a>>b>>c;

    if(a-b==b-c)

    {

    cout<<"YES";

    return 0;

    }

    cout<<"NO"<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

int a,b,c;

int main ()

{

	scanf ("%d %d %d",&a,&b,&c);

	printf ("%s\n",b-a==c-b?"YES":"NO");

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

bool zs(int n)

{

	for(int i=2;i*i<=n;++i)

		if(n%i==0)

			return false;

	return true;

}

bool hw(int n)

{

	int m=0,k=n;

	while(k!=0)

	{

		m=m*10+k%10;

		k/=10;

	}

	if(m==n)

		return true;

	return false;

}

int main()

{

	int a,b,c;

	cin>>a>>b>>c;

	if(b-a==c-b)

		cout<<"YES";

	else

		cout<<"NO";

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

int a,b,c;

int main ()

{

	scanf ("%d %d %d",&a,&b,&c);

	printf ("%s\n",b-a==c-b?"YES":"NO");

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int a,b,c;

int main()

{

	cin>>a>>b>>c;

	if(b-a==c-b)

	    cout<<"YES";

	else

	    cout<<"NO";

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

int a,b,c;

int main ()

{

	scanf ("%d %d %d",&a,&b,&c);

	printf ("%s\n",b-a==c-b?"YES":"NO");

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define ll long long int

int main()

{

    int a,c,b;

   // string s,ss;

    cin>>a>>b>>c;

    if((b-a)==(c-b))

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;

}














// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

int main ()

{

    int a,b,c;

    scanf("%d %d %d",&a,&b,&c);

    int x=b-a;

    int y=c-b;

    if(x==y)

    printf("YES\n");



    else

        printf("NO\n");

        return 0;



}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;





int main()

{

    int a,b,c,A,B;



    cin>>a>>b>>c;

     A=b-a;

     B=c-b;

    if(A==B)printf("YES\n");

    else cout<<"NO\n";

    return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

int main ()

{

    int a,b,c;

    scanf("%d %d %d",&a,&b,&c);

    int x=b-a;

    int y=c-b;

    if(x==y)

    printf("YES\n");



    else

        printf("NO\n");

        return 0;



}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b>>c;

    if(b-a==c-b) cout<<"YES"<<endl;

        else cout<<"NO"<<endl;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int a,b,c;

int main(){

	scanf("%d%d%d",&a,&b,&c);

	if(b-a==c-b) printf("YES\n");

	else printf("NO\n");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;







int main()

{

	int a,b,c;

	cin>>a>>b>>c;

	if(b-a == c-b)

	cout<<"YES";

	else 

	cout<<"NO";	

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include<algorithm>

using namespace std;

int main()

{

    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);

   if(b-a == c-b) printf("YES");

   else printf("NO");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int a,b,c;

int main()

{

	cin>>a>>b>>c;

	if(b-a==c-b) cout<<"YES"<<endl;

	else cout<<"NO"<<endl;



	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include<algorithm>

using namespace std;

int main()

{

    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);

   if(b-a == c-b) printf("YES");

   else printf("NO");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<iostream>

#include<string>

#include<algorithm>

using namespace std;





int main()

{

	int a[5], len = 0;

	string st;



	for (int i = 1; i <= 3; i++)

	{

		cin >> a[i];

	}

	

	if (a[3] - a[2] == a[2] - a[1])

		cout << "YES" << endl;

	else

		cout << "NO" << endl;



	return 0; 

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include<algorithm>

using namespace std;

int main()

{

    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);

   if(b-a == c-b) printf("YES");

   else printf("NO");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b,c;

    while(cin>>a>>b>>c)

    {

        if((b-a)==(c-b))

            cout<<"YES"<<endl;

        else

            cout<<"NO"<<endl;

    }

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

int main(void){

	int a,b,c;

	scanf("%d%d%d",&a,&b,&c);

	if((b-a)==(c-b)){

		printf("YES\n");

	} else{

		printf("NO\n");

	}

	system("pause");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b>>c;

    if(b-a==c-b)

        cout<<"YES"<<endl;

    else

        cout<<"NO"<<endl;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<stdlib.h>

int main(void){

	int a,b,c;

	scanf("%d%d%d",&a,&b,&c);

	if((b-a)==(c-b)){

		printf("YES\n");

	} else{

		printf("NO\n");

	}

	system("pause");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstring>

#include<string>

#include<algorithm>

#include<cstdio>

#include<queue>

using namespace std;

#define N 100002

int dis1[N],dis2[N];

int vis[N];

vector<int> g[N];

queue<int> q;

int dir[4][2]={{0,-1},{-1,0},{0,1},{1,0}};

void BFS1() //从哪个节点开始 

{

	int i,now;

	int st; 

	while( !q.empty() )

	{

		st = q.front();

		q.pop();

		for( i=0;i<g[st].size();i++ )

		{

			now = g[st][i];

			if( vis[now] )

				continue;

			vis[now]=1;

			dis1[now] = dis1[st] + 1;

			q.push(now);

		}

	}

}

void BFS2() //从哪个节点开始 

{

	int i,now;

	int st; 

	while( !q.empty() )

	{

		st = q.front();

		q.pop();

		for( i=0;i<g[st].size();i++ )

		{

			now = g[st][i];

			if( vis[now] )

				continue;

			vis[now]=1;

			dis2[now] = dis2[st] + 1;

			q.push(now);

		}

	}

}

int main(){

	int to,from,i,n;

	cin>>n;

	for( i=0;i<n-1;i++ ){

		cin>>to>>from;

		g[to].push_back(from);

		g[from].push_back(to);

	}

	q.push(1);

	BFS1();

	memset(vis,0,sizeof(vis));

	q.push(n);

	BFS2();

	int cntF=0;

	for( i=1;i<=n;i++ )

	{

		if( dis1[i]<=dis2[i] )

			cntF++;

	}

	int cntS = n-cntF;

	if( cntF>cntS )

		cout<<"Fennec\n";

	else

		cout<<"Snuke\n";

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#define N 100005

int n;

struct edge{

    int to,next;

}e[N<<1];

int head[N],cnt;

void add(int u,int v){

    e[++cnt]=(edge){v,head[u]};

    head[u]=cnt;

}

int son[N];

int path[N],len;

bool dfs(int x,int fa){

    bool p=x==n;

    for(int i=head[x];i;i=e[i].next){

        int v=e[i].to;

        if(v==fa)continue;

        p|=dfs(v,x);

    }

    son[fa]+=son[x]+1;

    if(p){

        path[++len]=x;

        return true;

    }

    return false;

}

int main(){

    scanf("%d",&n);

    for(int i=1,u,v;i<n;++i){

        scanf("%d%d",&u,&v);

        add(u,v);add(v,u);

    }

    dfs(1,0);

    int ans=0;

    for(int i=len;i>len/2;--i)

        ans+=son[path[i]]-son[path[i-1]];

    printf("%s\n",ans*2>n?"Fennec":"Snuke");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define ALL(x) (x).begin(),(x).end()

#define uniq(x) (x).erase(unique(ALL(x)),(x).end())

#define SORT(x) sort(ALL(x))

#define REV(x) reverse(ALL(x))

#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)

#define debug(x) cerr<<#x<<"="<<(x)<<endl

#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl

#define ri(x) scanf("%d",&x)

#define rl(x) scanf("%lld",&x)

#define rlcfpoj(x) scanf("%I64d",&x)

#define pi(x) printf("%d",x)

#define pl(x) printf("%lld",x)

#define plcfpoj(x) printf("%I64d",x)

#define lfd() printf("\n")

#define sp() printf(" ")

#define inrep(x) int x;scanf("%d",&x);while(x--)

#define testbit(mask,i) (((mask)>>(i))&1)

#define setbit(mask,i) ((mask)|(1<<i))

#define delbit(mask,i) ((mask)^(1<<i))

int n,u,v;

int dist1[100100],dist2[100100];

vector<int> ga[100100];

void dfs1(int u,int p){

	dist1[u]=dist1[p]+1;

	for(int i=0;i<ga[u].size();i++){

		int v=ga[u][i];

		if(v!=p)

			dfs1(v,u);

	}

}

void dfs2(int u,int p){

	dist2[u]=dist2[p]+1;

	for(int i=0;i<ga[u].size();i++){

		int v=ga[u][i];

		if(v!=p)

			dfs2(v,u);

	}

}

int main(){

	//freopen("input.txt","r",stdin);

	//freopen("output.txt","w",stdout);

	ios::sync_with_stdio(false);

	cin.tie(NULL);

	cout.tie(NULL);

	cin>>n;

	for(int i=1;i<n;i++){

		cin>>u>>v;

		ga[u].push_back(v);

		ga[v].push_back(u);

	}

	dfs1(1,0);

	dfs2(n,0);

	int snuke=0,fennec=0;

	for(int i=1;i<=n;i++){

		if(dist1[i]<=dist2[i])

			fennec++;

		else

			snuke++;

	}

	if(snuke>=fennec)

		cout<<"Snuke"<<endl;

	else

		cout<<"Fennec"<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#define N 100005

int n;

struct edge{

    int to,next;

}e[N<<1];

int head[N],cnt;

void add(int u,int v){

    e[++cnt]=(edge){v,head[u]};

    head[u]=cnt;

}

int son[N];

int path[N],len;

bool dfs(int x,int fa){

    bool p=x==n;

    for(int i=head[x];i;i=e[i].next){

        int v=e[i].to;

        if(v==fa)continue;

        p|=dfs(v,x);

    }

    son[fa]+=son[x]+1;

    if(p){

        path[++len]=x;

        return true;

    }

    return false;

}

int main(){

    scanf("%d",&n);

    for(int i=1,u,v;i<n;++i){

        scanf("%d%d",&u,&v);

        add(u,v);add(v,u);

    }

    dfs(1,0);

    int ans=0;

    for(int i=len;i>len/2;--i)

        ans+=son[path[i]]-son[path[i-1]];

    printf("%s\n",ans*2>n?"Fennec":"Snuke");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

#define SZ(v) ((int)(v).size())

#define rep(i,n) for(int i=0;i<(n);i++)

#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)

#define all(v) (v).begin(),(v).end()

typedef long long ll;

typedef unsigned uint;

const int INF=0x3f3f3f3f;

int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)

{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}

while((uint)((c=getchar())-'0')<10);return x;}

int n;

const int MAXN=1e5+5;

int ghead[MAXN],gnxt[2*MAXN],gto[2*MAXN];

int path[MAXN],npath;

int col[MAXN];

bool dfs(int v,int p){

	if(v==n-1){

		npath=0;path[npath++]=v;return true;

	}

	for(int x=ghead[v];x!=-1;x=gnxt[x]){

		int to=gto[x];

		if(to!=p){

			if(dfs(to,v)){

				path[npath++]=v;return true;

			}

		}

	}

	return false;

}

void dfscol(int v,int p){

	for(int x=ghead[v];x!=-1;x=gnxt[x]){

		int to=gto[x];

		if(to!=p&&col[to]==-1){

			col[to]=col[v];

			dfscol(to,v);

		}

	}

}

int main(){

    cin.sync_with_stdio(false);cin.tie(0);

	cin>>n;

	rep(i,n)ghead[i]=-1;

	rep(i,n-1){

		int a,b;

		cin>>a>>b;

		--a;--b;

		gnxt[2*i+0]=ghead[a];ghead[a]=2*i+0;gto[2*i+0]=b;

		gnxt[2*i+1]=ghead[b];ghead[b]=2*i+1;gto[2*i+1]=a;

	}

	dfs(0,0);

	reverse(path,path+npath);

//	rep(i,npath)cout<<path[i]<<' ';cout<<endl;

	rep(i,n)col[i]=-1;

	rep(i,npath)col[path[i]]=i<(npath+1)/2?0:1;

	rep(i,npath)dfscol(path[i],path[i]);

	int na=0,nb=0;

	rep(i,n){

		if(col[i]==0)na++;

		else nb++;

	}

//	rep(i,n)cout<<col[i]<<' ';cout<<endl;

//	cout<<na<<' '<<nb<<endl;

	string ans=na>nb?"Fennec":"Snuke";

	cout<<ans<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#define N 100005

int n;

struct edge{

    int to,next;

}e[N<<1];

int head[N],cnt;

void add(int u,int v){

    e[++cnt]=(edge){v,head[u]};

    head[u]=cnt;

}

int son[N];

int path[N],len;

bool dfs(int x,int fa){

    bool p=x==n;

    for(int i=head[x];i;i=e[i].next){

        int v=e[i].to;

        if(v==fa)continue;

        p|=dfs(v,x);

    }

    son[fa]+=son[x]+1;

    if(p){

        path[++len]=x;

        return true;

    }

    return false;

}

int main(){

    scanf("%d",&n);

    for(int i=1,u,v;i<n;++i){

        scanf("%d%d",&u,&v);

        add(u,v);add(v,u);

    }

    dfs(1,0);

    int ans=0;

    for(int i=len;i>len/2;--i)

        ans+=son[path[i]]-son[path[i-1]];

    printf("%s\n",ans*2>n?"Fennec":"Snuke");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <queue>

using namespace std;



struct edge{

    int to;

    int cost;

    edge(int a, int b){

        to=a;

        cost=b;

    }

};

typedef pair<long long, int> P;

struct D{

    vector<edge> G[100008];

    long long d[100008],INF=1e18;

    void AddEdge(int from, int to, int cost){

        G[from].push_back(edge(to, cost));

    }

    void dijkstra(int n, int s){

        priority_queue<P, vector<P>, greater<P>> q;

        fill(d,d+n,INF);

        d[s]=0;

        q.push(P(0,s));

        while(!q.empty()){

            P p=q.top();

            q.pop();

            int v=p.second;

            if(d[v]<p.first)continue;

            for(int i=0;i<G[v].size();i++){

                edge e=G[v][i];

                if(d[e.to]>d[v]+e.cost){

                    d[e.to]=d[v]+e.cost;

                    q.push(P(d[e.to],e.to));

                }

            }

        }

    }

};



int main(void){

    int n,f=0;

    D d,e;

    cin>>n;

    for(int i=0;i<n-1;i++){

        int a,b;

        cin>>a>>b;

        a--;

        b--;

        d.AddEdge(a,b,1);

        d.AddEdge(b,a,1);

        e.AddEdge(a,b,1);

        e.AddEdge(b,a,1);

    }

    d.dijkstra(n,0);

    e.dijkstra(n,n-1);

    for(int i=1;i<n-1;i++){

        if(d.d[i]<=e.d[i]){

            f++;

        }

    }

    if(f>n-2-f){

        cout<<"Fennec"<<endl;

    }else{

        cout<<"Snuke"<<endl;

    }

}




// Optimized solution to the same problem (faster):
#include <iostream>

#include <vector>

using namespace std;

int d[100000][2];

vector<int> v[100000];

void f(int x, int y, int z){

    d[x][y] = z;

    for(int i=0;i<v[x].size();i++){

        if(d[v[x][i]][y] == -1){

            f(v[x][i], y, z+1);

        }

    }

}

int main(void){

    int n, c=0;

    cin >> n;

    for(int i=0;i<n-1;i++){

        int a, b;

        cin >> a >> b;

        a--;

        b--;

        v[a].push_back(b);

        v[b].push_back(a);

    }

    for(int i=0;i<n;i++){

        d[i][0] = d[i][1] = -1;

    }

    f(0, 0, 0);

    f(n-1, 1, 0);

    for(int i=0;i<n;i++){

        if(d[i][0] <= d[i][1]){

            c++;

        }

    }

    

    if(c*2 > n){

        cout << "Fennec" << endl;

    }else{

        cout << "Snuke" << endl;

    }

}


// Fastest known solution for this problem: