Language: C++

#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
using namespace std;

class Node{

public:
  vector<int> next_node;
  void set_node(int _a){
	next_node.push_back(_a);
  }
};


int count_tree(int size,
			   vector<int> route,
			   vector<Node> all_node){

  int now_pos=route[route.size()-1];
  for(int i=0;i<all_node[now_pos].next_node.size();i++){
	int next=all_node[now_pos].next_node[i];
   	auto itr=find(route.begin(),
				  route.end(),
				  next);
	size_t index=distance(route.begin(),itr);

	if(index==route.size()){
	  size++;
	  route.push_back(next);
	  size=count_tree(size,
					  route,
					  all_node);
	  route.pop_back();
	}

  }
  return size;
}

vector<int> tree_dfs(vector<int> goal_route,
					 vector<Node> all_node){
  int now_pos=goal_route[goal_route.size()-1];
  for(int i=0;i<all_node[now_pos].next_node.size();i++){
	int next=all_node[now_pos].next_node[i];
   	auto itr=find(goal_route.begin(),
				  goal_route.end(),
				  next);
	size_t index=distance(goal_route.begin(),itr);
	if(index==goal_route.size()){
	  goal_route.push_back(next);
	  if(next==all_node.size()-1){
		return goal_route;
	  }else{
		goal_route=tree_dfs(goal_route,all_node);
		if(goal_route[goal_route.size()-1]
		   ==all_node.size()-1){
		  return goal_route;
		}	
		goal_route.pop_back();
	  }
	}
  }
  return goal_route;
}


int main(){
  int N;
  cin >> N;

  vector<int> a(N);
  vector<int> b(N);
  vector<Node> node(N);

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

  vector<int> goal_route={0};
  goal_route=tree_dfs(goal_route,node);

  for(int i=0;i<goal_route.size();i++){
	cout << goal_route[i] <<  " ";
  }
  cout << endl;

  int black_end,white_end;

  if(goal_route.size()%2==0){
	black_end=goal_route[goal_route.size()/2-1];
	white_end=goal_route[goal_route.size()/2];
  }else{
	black_end=goal_route[goal_route.size()/2];
	white_end=goal_route[goal_route.size()/2+1];
  }

  for(int i=0;i<node[black_end].next_node.size();i++){
	if(node[black_end].next_node[i]==white_end){
	  node[black_end].next_node.erase(node[black_end].next_node.begin()+i);
	  break;
	}
  }

  for(int i=0;i<node[white_end].next_node.size();i++){
	if(node[white_end].next_node[i]==black_end){
	  node[white_end].next_node.erase(node[white_end].next_node.begin()+i);
	  break;
	}
  }

  int black_size,white_size;
  vector <int> black_route={0};
  vector <int> white_route={N-1};

  black_size=count_tree(1,black_route,node);
  white_size=count_tree(1,white_route,node);

  
  if(black_size>white_size){
	cout << "Fennec" << endl;
  } else{
	cout << "Snuke" << endl;	
  }

  return 0;
}
Yoshito-MacBook:cpp yoshitoi$ fg
emacs-25.1 -nw template.cpp

[1]+  Stopped                 emacs-25.1 -nw template.cpp
Yoshito-MacBook:cpp yoshitoi$ cat abc067_d.cpp 
#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
using namespace std;

class Node{

public:
  vector<int> next_node;
  void set_node(int _a){
	next_node.push_back(_a);
  }
};


int count_tree(int size,
			   int now_pos,
			   vector<int> visited,
			   vector<Node> all_node){
  
  visited[now_pos]=1;
  for(int i=0;i<all_node[now_pos].next_node.size();i++){
	int next=all_node[now_pos].next_node[i];
	if(visited[next]==0){
	  size++;
	  size=count_tree(size,
					  next,
					  visited,
					  all_node);
	}

  }
  return size;
}

vector<int> tree_dfs(vector<int> goal_route,
					 vector<int> visited,
					 vector<Node> all_node){
  int now_pos=goal_route[goal_route.size()-1];
  visited[now_pos]=1;
  for(int i=0;i<all_node[now_pos].next_node.size();i++){
	int next=all_node[now_pos].next_node[i];
	if(visited[next]==0){
	  goal_route.push_back(next);
	  if(next==all_node.size()-1){
		return goal_route;
	  }else{
		goal_route=tree_dfs(goal_route,visited,all_node);
		if(goal_route[goal_route.size()-1]
		   ==all_node.size()-1){
		  return goal_route;
		}
		goal_route.pop_back();
	  }
	}
  }
  return goal_route;
}


int main(){
  int N;
  cin >> N;

  vector<int> a(N);
  vector<int> b(N);
  vector<Node> node(N);

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

  vector<int> goal_route={0};
  vector<int> visited1(N,0);
  goal_route=tree_dfs(goal_route,visited1,node);


  int black_end,white_end;

  if(goal_route.size()%2==0){
	black_end=goal_route[goal_route.size()/2-1];
	white_end=goal_route[goal_route.size()/2];
  }else{
	black_end=goal_route[goal_route.size()/2];
	white_end=goal_route[goal_route.size()/2+1];
  }

  for(int i=0;i<node[black_end].next_node.size();i++){
	if(node[black_end].next_node[i]==white_end){
	  node[black_end].next_node.erase(node[black_end].next_node.begin()+i);
	  break;
	}
  }

  for(int i=0;i<node[white_end].next_node.size();i++){
	if(node[white_end].next_node[i]==black_end){
	  node[white_end].next_node.erase(node[white_end].next_node.begin()+i);
	  break;
	}
  }

  int black_size,white_size;
  vector <int> visited2(N,0);

  black_size=count_tree(1,0,visited2,node);
  white_size=count_tree(1,N-1,visited2,node);

  
  if(black_size>white_size){
	cout << "Fennec" << endl;
  } else{
	cout << "Snuke" << endl;	
  }

  return 0;
}

Compiler output:
a.cc:131:1: error: 'Yoshito' does not name a type
  131 | Yoshito-MacBook:cpp yoshitoi$ fg
      | ^~~~~~~
a.cc:142:7: error: redefinition of 'class Node'
  142 | class Node{
      |       ^~~~
a.cc:7:7: note: previous definition of 'class Node'
    7 | class Node{
      |       ^~~~
a.cc:197:5: error: redefinition of 'int main()'
  197 | int main(){
      |     ^~~~
a.cc:69:5: note: 'int main()' previously defined here
   69 | int main(){
      |     ^~~~