N,M,*rest = $stdin.read.split.map(&:to_i)

bs = Array.new(N+1)
nodes = Array.new(10**5+1).map { Array.new }
rest.each_slice(2) do |a,b|
  nodes[a] ||= []
  nodes[a] << b
  bs[b] = 1
end

targets = []
1.upto(N+1) do |i|
  unless bs[i]
    targets = [i]
    break
  end
end
as = Array.new(N, 0)

until targets.empty?
  next_targets = []
  targets.each do |t|
    children = nodes[t]
    next unless children
    next_targets += children
    children.each do |x|
      as[x-1] = t
    end
  end
  targets = next_targets
end

puts as.join("\n")