#!/usr/local/bin/ruby
n=gets.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
}
for j in 0..n-1
   puts arr[j]
end