$m = gets.to_i
$n = gets.to_i
$s = (1..$n).map{gets.split.map(&:to_i)}
$f = false

def solve(a)
  if a.size == $m
    $f = true
    puts a
    return
  end
  $s.select{|e|a.include?(e[1])&& !a.include?(e[0])}.map{|e|
    if $f
      return
    end
    solve(a + [e[0]])
  }
end

solve([2])