$m = gets.to_i
$n = gets.to_i
$s = (1..$n).map{gets.split.map(&:to_i)}
 
def solve(a)
  if a.size == $m
    return a
  end
  $s.select{|e|a.include?(e[1])&& !a.include?(e[0])}.map{|e|
    r = solve(a + [e[0]])
    if r
      return r
    end
  }
end
 
p solve([2])