require 'tsort'

class Hash
  include TSort
  alias tsort_each_node each_key
  def tsort_each_child(node, &block)
    fetch(node).each(&block)
  end
end

N,M=gets.split(" ").map{|i| i.to_i}
h = {}
revh = {} # child -> parents
for i in 0..(N-1)
	h[i+1] = []
	revh[i+1] = []
end
for i in 0..(N-2+M)
	a,b = gets.split(" ").map{|i| i.to_i}
	h[a].nil? ? h[a] = [b] : h[a] << b
	revh[b].nil? ? revh[b] = [a] : revh[b] << a
end
# p h
tsorted = h.tsort

indarr = Array.new(N+1) { |i| 0 } # 1 indexed
par = Array.new(N+1) { |i| 0 } # 1 indexed
indarr[0] = nil
par[0] = nil
indarr[tsorted[N-1]] = 0
(N-2).downto(0){|i|
	node = tsorted[i]
	parent = revh[node].max{|t,s| indarr[t] <=> indarr[s]}
	par[node] = parent
	indarr[node] = 1 + indarr[parent]
}
# p indarr
# p par
for i in 1..(N)
	puts par[i]
end
