#inlcude<iostream>
#include<vector>
#include<map>
using namespace std;

const int max_nodes = 100, max_edges;

vector<pair<int, int> > adj[max_nodes];
vector<int> stack;

bool seen[max_edges];

void dfs(int node){
	int next = -1;
	for(int i = 0; i < adj[node].length(); i++){
		int edge = adj[node][i];
		if(!seen[edge.second]]){
			seen[edge.second] = true;
			stack.push_back(node);
			dfs(edge.first);
			could_exit = true;
			break;
		}
	}
	if(!could_exit){
		cout<< node <<endl;
	}
}

int main(){
	int n, m;
	cin>> n>> m;
	for(int i = 0; i < m; i++){
		int x, y;
		cin>> x>> y;
		x--; y--;
		adj[x].push_back(make_pair(y, i));
		adj[y].push_back(make_pair(x, i));
	}
	int odd_node = -1;
	for(int i=0; i<n ;i++){
		if(adj[i].length()%2){
			odd_node = i;
		}
	}

	trail(odd_node==-1?0: odd_node);
}