@m = gets.to_i
@n = gets.to_i
@s = (1..@n).map{ |e| gets.split(' ').map(&:to_i) }

def solve(a)
  if a.size == @m
    return a
  end

  @s.select{ |e| a.include?(e[1]) and !a.include?(e[0]) }.map do |e|
    r = solve(a + [e[0]])
    return r if r
  end
end

puts solve([2])