#!/usr/local/bin/ruby
while line=gets
   n=line.to_i
   m=gets.to_i
   arr=Array.new
   for i in 0..n-1
      arr << i+1
   end
   m.times{
      rec=gets.split("")
      x,y=rec[0].to_i,rec[2].to_i
      tmp=arr[x-1]
      arr[x-1]=arr[y-1]
      arr[y-1]=tmp
   }
   break
end
   for j in 0..n-1
      puts arr[j]
   end