import java.util.*;
import java.io.*;

public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<List<Integer>>adj = new ArrayList<>();

        int n = sc.nextInt(); //no of nodes
        int m =sc.nextInt(); //no of edges
        
        for(int i=0;i<n;i++){
            adj.add(new ArrayList<>());
        }
        
        for(int i=0;i<m;i++){
            int x =sc.nextInt();
            int y = sc.nextInt();
            
            adj.get(x).add(y);
            adj.get(y).add(x);
        }
        for(int i=0;i<n;i++){
            if(adj.get(i).size() == 1){
                System.out.print(i + " ");
            }
        }
	}
}