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

typedef long long ll;

const int maxn=1e6+5;

using namespace std;

const ll INF=1e13+7;

ll n,m;

char str[maxn];

ll dp[maxn];

ll q[maxn];

int pre[maxn];

void TraceBack(int x)

{

    if(pre[x]==-1)

    {

        printf("%d",x);

        return;

    }

    TraceBack(pre[x]);

    printf(" %d",x-pre[x]);

}

int main()

{

    memset(pre,-1,sizeof(pre));

    scanf("%lld%lld",&n,&m);

    scanf("%s",str);

    //数有n+1个

    int s=1,e=0;

    for(int i=0;i<=m;i++)

    {

        if(str[i]=='0')

            dp[i]=1;

        else

            dp[i]=INF;

        while(s<=e&&dp[i]<dp[q[e]]) e--;

        q[++e]=i;

    }

    s++;

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

    {

        dp[i]=INF;

        if(str[i]=='0')

        {

            dp[i]=min(dp[q[s]]+1,dp[i]);

            if(dp[i]!=INF)

                pre[i]=q[s];

        }

        while(s<=e&&dp[i]<dp[q[e]]) e--;

        q[++e]=i;

        while(s<=e&&q[s]<i+1-m)

            s++;

    }

    if(dp[n]==INF) printf("-1\n");

    else TraceBack(n);

    return 0;

}




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

using namespace std;

#define ll long long 

ll n,m,cur;

int main(){

  vector<ll> ans;

  string s;

  cin>>n>>m>>s;

  cur=n;

  while(cur)

  {

  	 bool check=true;

  	 for(int i=max(0ll,cur-m);i<cur;i++)

  	    if(s[i]=='0'){

  	    	check=false;

  	    	ans.push_back(cur-i);

  	    	cur=i;

  	    	break;

  	    }

  	  if(check){

  	  	cout<<-1<<endl;return 0;

  	  }

  }

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

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

  	  cout<<ans[i];

  	  if(i==ans.size()-1)cout<<endl;

  	  else cout<<" ";

  }







	return 0;

}


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

#include <cstdio>

#include <set>

#include <vector>

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

const int MAXN = 1e5+5;

char S[MAXN];

std::set<int> good;

std::vector<int> step;

int M, N;



void display() {

    for (int x: step) {

        printf("%d ", x);

    }

    putchar('\n');

}



void init() {

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

        if (S[i] == '0') {

            good.insert(i);

        }

    }

}



void solve() {

    M = std::min(N, M);

    int cur = N;

    while (cur > 0) {

        int prev = std::max(cur - M, 0);

        auto ptr = good.lower_bound(prev);

        if (*ptr == cur) {

            step.assign({-1});

            return;

        }

        step.push_back(cur - *ptr);

        cur = *ptr;

    }

    std::reverse(ALL(step));

}



int main() {

    scanf(" %d%d%s", &N, &M, S);

    init();

    solve();

    display();

    return 0;

}

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

#include <cstdio>

const int MAXN = 1e5+5;

char  S[MAXN];

int out[MAXN];

int M, N;

int K;



// Greedily take largest possible steps from N -> 0

// Range [head, tail) are Game Over squares



void display() {

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

    printf("%d ", out[i]);

  }

  putchar('\n');

}



bool solve() {

  M = std::min(N, M);

  K = 0;

  int head = N;

  int tail = N;

  while (tail > 0) {

    int src = tail - std::min(M, tail);

    auto is_valid = [](char c) { return (c == '0'); };

    auto itr = std::find_if(S+src, S+head, is_valid);

    int next = itr - S;

    if (next == head) {

      return false;

    }

    head = src;

    out[K++] = (tail - next);

    tail = next;

  }

  std::reverse(out, out+K);

  return true;

}



int main() {

  scanf(" %d%d%s", &N, &M, S);

  if (solve()) {

    display();

  } else {

    puts("-1");

  }

  return 0;

}

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



using namespace std;

#define ll long long

#define ull unsigned long long

#define mp make_pair

typedef pair<int, int> pii;

typedef priority_queue<int, vector<int>, greater<int> > small_heap;

typedef priority_queue<int> big_heap;

int n, m, f[200009], g[200009], st[200009], top = 0;

char str[200009];

struct node {

    int v, id;

};

deque<node> q;



int main() {

    memset(g, -1, sizeof(g));

    memset(f, 0x3f, sizeof(f));

    scanf("%d%d", &n, &m);

    scanf("%s", str);

    f[0] = 0, q.push_back({f[0], 0});

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

        while (!q.empty() && i - q.front().id > m)q.pop_front();

        if (str[i] == '1')continue;

        if (!q.empty())f[i] = q.front().v + 1, g[i] = q.front().id;

        while (!q.empty() && q.back().v > f[i])q.pop_back();

        if (f[i] != 0x3f3f3f3f)q.push_back({f[i], i});

    }

    if (g[n] == -1)return puts("-1"), 0;

    int now = n;

    while (g[now] != -1) { st[++top] = now - g[now], now = g[now]; }

    while (top) {

        printf("%d ", st[top--]);

    }

    puts("");

    return 0;

}

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

using namespace std;



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<int, pii> pipii;

typedef pair<pii, pii> piipii;



#define mp make_pair

#define fi first

#define se second

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

#define sz(a) (int)(a).size()

#define eb emplace_back

int dp[100005], pv[100005];

string s;

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    int n, m;

    cin >> n >> m;

    cin >> s;



    memset(dp, -1, sizeof(dp));

    dp[0] = 0;



    deque<int> dq;

    dq.push_back(0);

    n++;

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

        if(s[i] == '1') continue;

        while(!dq.empty() && i-dq.front() > m) dq.pop_front();

        if(dq.empty()) continue;

        dp[i] = dp[dq.front()]+1;

        pv[i] = dq.front();

        while(!dq.empty() && dp[dq.back()] > dp[i]) dq.pop_back();

        dq.push_back(i);

    }

    if(dp[n-1] == -1) printf("-1\n");

    else{

        vector<int> ans;

        int u = n-1;

        while(u != 0){

            ans.eb(u-pv[u]);

            u = pv[u];

        }

        reverse(all(ans));



        for(int i=0;i<sz(ans);i++) printf("%d ", ans[i]);

        printf("\n");

    }

}

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

#include <string>

#include <iostream>

using namespace std;

inline int m_min(int x,int y)

{ return x<y ? x : y; }

const int Mn(100050);

int ans[Mn];

int main()

{

	int n,m;

	string s;

	cin >>n>>m>> s;

	int cnt(0),p(n);

	while(p)

	{

		bool flag(true);

		for(int i(m_min(p,m));i>=1;--i)

			if(s[p-i]=='0')

			{

				p = p-i;

				ans[++cnt] = i;

				flag = false;

				break;

			}

		if(flag)	break;

	}

	if(p!=0)	printf("-1");

	else

		for(int i(cnt);i;--i)

			printf("%d ",ans[i]);

	return 0;

}


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

#include <algorithm>

#define max(a,b)a>b?a:b



int ans[100070];

int R(){

	int x=0;char ch;

	do{ch=getchar();}while(ch>57||ch<48);

	do{x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}while(ch>=48&&ch<=57);

	return x;

}

void W(int c){

	if(c>9)W(c/10);

	putchar('0'+c%10);

}



char ch[1000000];



signed main(){

	int n=R(),m=R(),p,i,now;

	scanf("%s",ch);

	now=n;

	i=n;

	p=m;

	while(i>m){

		

		while(ch[i-p]=='1'){

			p--;

			if(p==0)

				break;

		}

		if(p==0)

			break;

		ans[now--]=p;

		i-=p;

		p=m;

	}

	if(p==0){

		printf("-1");

	}

	else{

		printf("%d ",i);

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

			printf("%d ",ans[i]);

		}

	}

}

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

#include<string>

#include<cstring>

using namespace std;

char s[10001];

int main()

{

    cin>>s;

    if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I')

        cout<<"Yes\n";

    else

        cout<<"No\n";

}

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

char s[11];

int main()

{

    scanf("%s",s);

    if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I') 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()

{

    string s;

    cin>>s;

    if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I') cout<<"Yes"<<endl;

        else cout<<"No"<<endl;

    return 0;

}

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

char s[11];

int main()

{

    scanf("%s",s);

    if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I') 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;

string st;

int main()

{

    cin>>st;

    if(st[0]=='Y' && st[1]=='A' && st[2]=='K' && st[3]=='I') cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;

}

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

char s[11];

int main()

{

    scanf("%s",s);

    if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I') 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()

{

    char s1[10];

   cin>>s1;

     char s2[10];

   cin>>s2;

     char s3[10];

   cin>>s3;

    if(s1[0]>='a' && s1[0]<='z')

    {

          s1[0]-=32;

        

    }

     if(s2[0]>='a' && s2[0]<='z')

    {

       s2[0]-=32;

      

    }

      if(s3[0]>='a' && s3[0]<='z')

    {  s3[0]-=32;

       

    }

    cout << s1[0]<<s2[0]<<s3[0];

}

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

#include <string.h>



int main() {

  char str[255];

  scanf("%[^\n]", str);



  printf("%c", str[0] - 32);



  for(int i = 1; str[i] != '\0'; i++) {

    if(str[i] == ' ') {

      printf("%c", str[i+1] - 32);

    }

  }



  puts("");

  return 0;

}




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

#include <iostream>

using namespace std;

int main()

{

    string s,s1,s2,s3;

cin>>s1>>s2>>s3;

    s=s1+' '+s2+' '+s3;

    cout<<(char)(s[0]-32);

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

    if(s[i]==' ')

    cout<<(char)(s[i+1]-32);

    else

    continue;

    }

    

    

}






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

#include <string.h>



int main() {

  char str[255];

  scanf("%[^\n]", str);



  printf("%c", str[0] - 32);



  for(int i = 1; str[i] != '\0'; i++) {

    if(str[i] == ' ') {

      printf("%c", str[i+1] - 32);

    }

  }



  puts("");

  return 0;

}




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

#include <vector>

using namespace std;

#define ll long long 

int n;

vector<int> g[100005];

int d1[100005],d2[100005];

inline void dfs(int r,int f,int d,int dist[])

{

    dist[r]=d;

    for(int x=0;x<g[r].size();x++){

        if(g[r][x]!=f){

        	dfs(g[r][x],r,d+1,dist);

		}

    }

}

int main()

{

    cin>>n;

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

    {

    	int a,b;

        cin>>a>>b;

        a--,b--;

        g[a].push_back(b);

        g[b].push_back(a);

    }

    dfs(0,-1,0,d1);

    dfs(n-1,-1,0,d2);

    int ans=0;

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

        if(d1[i]<=d2[i]){

            ans++;

		}

        else{

        	ans--;

        }

    }

    if(ans>0){

    	cout <<"Fennec"<< endl;

	}

    else{

    	cout<<"Snuke"<<endl;

	}

    return 0;

}

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

#include <cstring>

using namespace std;



int first[100003], next[200003], node[200003], n, len, ans[3], m;

char fs[100003];

bool vis[100003];



inline void readin(int n)

{

    int p = 1;

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

    {

        int u, v;

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

        next[p] = first[u];

        first[u] = p;

        node[p] = v;

        ++p;

        next[p] = first[v];

        first[v] = p;

        node[p] = u;

        ++p;

    }

}



bool dfs(int x, int deep)

{

    vis[x] = true;

    if (x == n)

    {

        len = deep >> 1;

        fs[n] = 2;

        ++ans[2];

        return true;

    }

    int t = first[x];

    while (t)

    {

        if (!vis[node[t]])

        {

            if (dfs(node[t], deep + 1))

            {

                if (deep > len)

                {

                    fs[x] = 2;

                    ++ans[2];

                }

                else

                {

                    fs[x] = 1;

                    ++ans[1];

                }

                return true;

            }

        }

        t = next[t];

    }

    return false;

}



void ddfs(int x)

{

    int t = first[x];

    while (t)

    {

        if (fs[node[t]] == 0)

        {

            ++ans[m];

            fs[node[t]] = m;

            ddfs(node[t]);

        }

        t = next[t];

    }

}



void init()

{

    memset(first, 0, sizeof first);

    memset(ans, 0, sizeof ans);

    memset(fs, 0, sizeof fs);

    memset(vis, false, sizeof vis);

}



int main()

{

    while (scanf("%d", &n) != EOF)

    {

        readin(n);

        dfs(1, 0);

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

        {

            if (fs[i])

            {

                m = fs[i];

                ddfs(i);

            }

        }

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

        init();

    }

}

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

#include <string>

#include <cstdio>

#include <vector>

#include <queue>

#include <list>

#include <cstdlib>

#include <algorithm>

#include <set>

#include <map>

#include <deque>

#include <cstring>

#include <cmath>

//#include<bits/stdc++.h>

using namespace std;



const int INF=0x3f3f3f3f;

const int SIZE=100005;



vector<int> mp[SIZE];

int color[SIZE],dist[SIZE],dist2[SIZE];



void bfs(int s,int dist[]){

	queue<int> que;

	que.push(s);

	while(!que.empty()){

		int u=que.front();

		que.pop();

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

			int t=mp[u][i];

			if(dist[t] || t==s) continue;

			dist[t]=dist[u]+1;

			que.push(t);

		}

	}

}



int main(){

	int n;

	scanf("%d",&n);

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

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

		a--;

		b--;

		mp[a].push_back(b);

		mp[b].push_back(a);

	}

	bfs(0,dist);

	bfs(n-1,dist2);

	int s=0,f=0;

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

		if(dist[i]<=dist2[i]) f++; else s++;

	}

	if(s>=f){

		puts("Snuke");

	}

	else{

		puts("Fennec");

	}

	return 0;

}


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

#include <cstring>

using namespace std;



int first[100003], next[200003], node[200003], n, len, ans[3], m;

char fs[100003];

bool vis[100003];



inline void readin(int n)

{

    int p = 1;

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

    {

        int u, v;

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

        next[p] = first[u];

        first[u] = p;

        node[p] = v;

        ++p;

        next[p] = first[v];

        first[v] = p;

        node[p] = u;

        ++p;

    }

}



bool dfs(int x, int deep)

{

    vis[x] = true;

    if (x == n)

    {

        len = deep >> 1;

        fs[n] = 2;

        ++ans[2];

        return true;

    }

    int t = first[x];

    while (t)

    {

        if (!vis[node[t]])

        {

            if (dfs(node[t], deep + 1))

            {

                if (deep > len)

                {

                    fs[x] = 2;

                    ++ans[2];

                }

                else

                {

                    fs[x] = 1;

                    ++ans[1];

                }

                return true;

            }

        }

        t = next[t];

    }

    return false;

}



void ddfs(int x)

{

    int t = first[x];

    while (t)

    {

        if (fs[node[t]] == 0)

        {

            ++ans[m];

            fs[node[t]] = m;

            ddfs(node[t]);

        }

        t = next[t];

    }

}



void init()

{

    memset(first, 0, sizeof first);

    memset(ans, 0, sizeof ans);

    memset(fs, 0, sizeof fs);

    memset(vis, false, sizeof vis);

}



int main()

{

    while (scanf("%d", &n) != EOF)

    {

        readin(n);

        dfs(1, 0);

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

        {

            if (fs[i])

            {

                m = fs[i];

                ddfs(i);

            }

        }

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

        init();

    }

}

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

using namespace std;

const int INF=1000000007;

vector<int> g[100005];

int dist1[100005],dist2[100005];

int main()

{

	int n;

	cin>>n;

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

	{

		int a,b;

		cin>>a>>b;

		a--;

		b--;

		g[a].push_back(b);

		g[b].push_back(a);

	}

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

		dist1[i]=INF,dist2[i]=INF;

	queue<int> q;

	q.push(0);

	dist1[0]=0;

	while(!q.empty())

	{

		int f=q.front();

		q.pop();

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

		{

			int s=g[f][i];

			if(dist1[s]==INF)

			{

				dist1[s]=dist1[f]+1;

				q.push(s);

			}

		}

	}

	q.push(n-1);

	dist2[n-1]=0;

	while(!q.empty())

	{

		int f=q.front();

		q.pop();

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

		{

			int s=g[f][i];

			if(dist2[s]==INF)

			{

				dist2[s]=dist2[f]+1;

				q.push(s);

			}

		}

	}

	int s1=0,s2=0;

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

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

			s1++;

		else

			s2++;

	if(s1>s2)

		cout<<"Fennec"<<endl;

	else

		cout<<"Snuke"<<endl;

	return 0;

}

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

#include <cstring>

using namespace std;



int first[100003], next[200003], node[200003], n, len, ans[3], m;

char fs[100003];

bool vis[100003];



inline void readin(int n)

{

    int p = 1;

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

    {

        int u, v;

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

        next[p] = first[u];

        first[u] = p;

        node[p] = v;

        ++p;

        next[p] = first[v];

        first[v] = p;

        node[p] = u;

        ++p;

    }

}



bool dfs(int x, int deep)

{

    vis[x] = true;

    if (x == n)

    {

        len = deep >> 1;

        fs[n] = 2;

        ++ans[2];

        return true;

    }

    int t = first[x];

    while (t)

    {

        if (!vis[node[t]])

        {

            if (dfs(node[t], deep + 1))

            {

                if (deep > len)

                {

                    fs[x] = 2;

                    ++ans[2];

                }

                else

                {

                    fs[x] = 1;

                    ++ans[1];

                }

                return true;

            }

        }

        t = next[t];

    }

    return false;

}



void ddfs(int x)

{

    int t = first[x];

    while (t)

    {

        if (fs[node[t]] == 0)

        {

            ++ans[m];

            fs[node[t]] = m;

            ddfs(node[t]);

        }

        t = next[t];

    }

}



void init()

{

    memset(first, 0, sizeof first);

    memset(ans, 0, sizeof ans);

    memset(fs, 0, sizeof fs);

    memset(vis, false, sizeof vis);

}



int main()

{

    while (scanf("%d", &n) != EOF)

    {

        readin(n);

        dfs(1, 0);

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

        {

            if (fs[i])

            {

                m = fs[i];

                ddfs(i);

            }

        }

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

        init();

    }

}

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

#include<vector>

#include<queue>

using namespace std;

const int cc=100005;

vector<int>poi[cc];

int color[cc]={0},cnt[2];

int main()

{

	queue<int>clr;

	int n,a,b;

	cin>>n;

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

	{

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

		poi[a].push_back(b);

		poi[b].push_back(a);

	}

	color[1]=1;

	color[n]=2;

	clr.push(1);

	clr.push(n);

	while(!clr.empty())

	{

		int tmp=clr.front();

		clr.pop();

		cnt[color[tmp]-1]++;

		for(int i=0;i<poi[tmp].size();i++)

		{

			if(color[poi[tmp][i]]) continue;

			color[poi[tmp][i]]=color[tmp];

			clr.push(poi[tmp][i]);

		}

	}

	if(cnt[0]>cnt[1]) cout<<"Fennec\n";

	else cout<<"Snuke\n";

	return 0;

}

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

#include <cstring>

#include <queue>

using namespace std;

const int maxn = 1e5 + 10;

const int maxm = 1e5 + 10;

struct edge{

	int to;

	int next;

}Edge[2 * maxm];

int head[maxn], pos, n, color[maxn];

void init(){

	for(int i = 0; i < maxn; i++) head[i] = -1;

	for(int i = 0; i < maxn; i++) color[i] = -1; // -1 is uncolored 1 is whrite, 0 is black

	pos = 0;

}

void addEdge(int u, int v){

	Edge[pos].to = v;

	Edge[pos].next = head[u];

	head[u] = pos;

	pos++;

}

void BFS(){

	queue <int> q;

	color[1] = 0;

	color[n] = 1;

	q.push(1);

	q.push(n);

	while(!q.empty()){

		int h = q.front();

		q.pop();

		for(int i = head[h]; i != -1; i = Edge[i].next){

			if(color[Edge[i].to] == -1){

				color[Edge[i].to] = color[h];

				q.push(Edge[i].to);

			}

		}

	}

}

// void BFS(){

// 	queue <int> qw;

// 	queue <int> qb;

// 	qw.push(n);

// 	color[n] = 1;

// 	qb.push(1);

// 	color[1] = 0;

// 	while(!qw.empty() || !qb.empty()){

// 		if(!qb.empty()){

// 			int h = qb.front();

// 			//cout << "B" << h << endl;

// 			qb.pop();

// 			for(int i = head[h]; i != -1; i = Edge[i].next){

// 				if(color[Edge[i].to] == -1){

// 					//cout << Edge[i].to << " ";

// 					color[Edge[i].to] = 0;

// 					qb.push(Edge[i].to);

// 				}

// 			}

// 			//cout << endl;

// 		}

// 		if(!qw.empty()){

// 			int h = qw.front();

// 			//cout << "W" << h << endl;

// 			qw.pop();

// 			for(int i = head[h]; i != -1; i = Edge[i].next){

// 				if(color[Edge[i].to] == -1){

// 					//cout << Edge[i].to << " ";

// 					color[Edge[i].to] = 1;

// 					qw.push(Edge[i].to);

// 				}

// 			}

// 			//cout << endl;

// 		}

// 	}



// }

int main(){

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

	while(scanf("%d", &n) != EOF){

		init();

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

			int u, v;

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

			addEdge(u, v);

			addEdge(v, u);

		}

		//cout << n << endl;

		BFS();

		int white = 0, black = 0;

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

			//cout << i << ":"<< color[i] << endl;

			if(color[i] == 1) white++;

			else black++;

		}

		//cout << white <<" "<< black << endl;

		if(white < black) printf("Fennec\n");

		else printf("Snuke\n");

	}

	return 0;

}








// Fastest known solution for this problem: