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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        int m=sc.nextInt()+n-1;
        int ts[]=new int[n];
        int dg[]=new int[n];
        int dg2[]=new int[n];
        ArrayList<Integer> lis[]=new ArrayList[n];
        for (int i = 0; i < lis.length; i++) {
            lis[i] = new ArrayList<Integer>();
        }

        for (int i = 0; i < m; i++) {
            int from=sc.nextInt()-1, to=sc.nextInt()-1;
            lis[from].add(to);
            dg[to]++;
            dg2[to]++;
        }
        int c=0;
        for (int i = 0; i < n; i++) {
            if(dg[i]==0)ts[c++]=i;
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0,to; j < lis[ts[i]].size(); j++) {
                to = lis[ts[i]].get(j);
                if(--dg[to]==0) ts[c++]=to;
            }
        }
        
        for (int i = 0; i < ts.length; i++) {
            for (int j = 0,to; j < lis[ts[i]].size(); j++) {
                to = lis[ts[i]].get(j);
                if(dg2[to]-->=2) {lis[ts[i]].remove(j--);}
            }			
		}
        int ans[]=new int[n];
        for (int i = 0; i < ts.length; i++) {
            for (int j = 0,to; j < lis[ts[i]].size(); j++) {
                to = lis[ts[i]].get(j);
                ans[to]=ts[i]+1;
            }
		}
        for (int i = 0; i < ans.length; i++) {
            out.println(ans[i]);
		}
//        out.println();
        out.flush();
    }
    
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

class P implements Comparable<P>{
    int a,b;
    P(int a, int b) {
        this.a=a;
        this.b=b;
    }
    public int compareTo(P p){
    	int A=a-p.b,B=b-p.a;
    	if(abs(A)>abs(B)) {return A<0 ?-1:1;}
        return B<0 ?-1:1; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 55112