N,M=gets.split.map(&:to_i)

edges=Array.new(N){Array.new}

root_flag=Array.new(N,true)

(N-1+M).times do
    a,b=gets.split.map(&:to_i)
    a-=1
    b-=1
    edges[a] << b
    root_flag[b]=false
end

root=root_flag.index(true)
parent=Array.new(N,-1)

queue=[root]

while !queue.empty?
    v=queue.shift
    edges[v].each do |vv|
        parent[vv]=v
        queue << vv
    end
end

parent.each do |i|
    puts i+1
end