Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func swap(ints []int, i, j int) {
	ints[i], ints[j] = ints[j], ints[i]
}

func main() {
	w := nextInt()
	// println(w)
	nums := make([]int, w)
	for i := range nums {
		nums[i] = i+1
	}
	n := nextInt()
	// println(n)
	for i := 0; i < n; i++ {
		info := nextString()
		// println(info)
		infos := strings.Split(info, ",")
		a, _ := strconv.Atoi(infos[0])
		b, _ := strconv.Atoi(infos[1])
		swap(nums, a-1, b-1)
	}
	for _, v := range nums {
		fmt.Println(v)
	}
}

Python: # -*- coding:utf-8 -*-

import sys

w = int(input())
n = int(input())

array = []
count = 0
for i in sys.stdin:
    array.append(i)
    count += 1
    if count == n:
        break

a, b = [0]*n, [0]*n
for i in range(n):
    s = array[i]
    a[i], b[i] = s[0], s[2]
    a[i], b[i] = int(a[i]), int(b[i])

lines = []
k = 0
for i in range(w):
    lines.append(k)
    k += 1 

for i in range(n):
    tmp1 = lines[a[i]-1]
    tmp2 = lines[b[i]-1]
    lines[a[i]-1] = tmp2
    lines[b[i]-1] = tmp1

for i in range(len(lines)):
    print(lines[i]+1)

Python: w = int(input())    # 縦線
n = int(input())    # 横線
combine = [list(map(int, input().split(","))) for _ in range(n)]   # 横棒の終始
answer = list(range(1, w+1))    # 回答

# 終始入れ替え
for com in combine:
    x, y = com
    answer[x-1], answer[y-1] = answer[y-1], answer[x-1]

# 出力（改行あり）
print('\n'.join(map(str, answer)))

Python: '''
Created on Mar 21, 2013

@author: wukc
'''

import sys
w=int(sys.stdin.readline())
n=int(sys.stdin.readline())
a=[i for i in range(w+1)]

for i in range(n):
    l=sys.stdin.readline()
    x,y=map(int,l.split(","))
    a[x],a[y]=a[y],a[x]
    
print("\n".join(map(str,a[1:])))

Python: numList = []
for i in range(int(input())):
    numList.append(i + 1)

for i in range(int(input())):
    a, b = list(map(int, input().split(',')))
    a, b = a - 1, b - 1
    tmp = numList[a]
    numList[a] = numList[b]
    numList[b] = tmp

for num in numList:
    print(num)

Python: a=list(range(int(input())+1))
for _ in[0]*int(input()):s,t=map(int,input().split(','));a[s],a[t]=a[t],a[s]
for s in a:s and print(s)

Python: # -*- coding: utf-8 -*-

import sys
import os
import math


tate = int(input())
yoko = int(input())
values = [i for i in range(tate)]
#print(values)

for _ in range(yoko):
    a, b = map(int, input().split(','))
    a -= 1
    b -= 1
    values[a], values[b] = values[b], values[a]

for i in values:
    print(i+1)

Python: w = int(input())
n = int(input())
l = list(range(1,w+1))
for i in range(n):
	a,b = map(int,input().split(','))
	a -= 1
	b -= 1
	l[a],l[b] = l[b],l[a]
for x in l:
	print(x)

Python: w = int(input())
n = int(input())
amida = [i for i in range(1, w + 1)]
for _ in range(n):
    a, b = list(map(int, input().split(',')))
    temp = amida[a - 1]
    amida[a - 1] = amida[b - 1]
    amida[b - 1] = temp
for i in amida:
    print(i)

Python: tate =int(input())
yoko=int(input())
arr = [i+1 for i in range(tate)]
for j in range(yoko):
    rep1,rep2=input().split(",")
    rep1=int(rep1)-1
    rep2=int(rep2)-1
    arr[rep1],arr[rep2] = arr[rep2],arr[rep1]

for k in range(tate):
    print(arr[k])

Python: def amida():
    line_number=int(input())
    line=[]
    for j in range(1,line_number+1):
        line.append(j)
    yoko=int(input())
    for i in range(yoko):
        a,b=map(int,input().split(","))
        line[a-1],line[b-1]=line[b-1],line[a-1]
    return line
while True:
    try:
        ans=amida()
        for i in range(int(len(ans))):
            print(ans[i])
        break
    except:break

Python: W = int(input())
ary = list(range(1, W + 1))
N = int(input())
for i in range(N):
    x,y = map(int,input().split(','))
    ary[x - 1], ary[y - 1] = ary[y - 1], ary[x - 1]
for i in ary:
    print(i)

Python: w = int(input())
n = int(input())

alist = []
blist = []
for _ in range(n):
    a, b = map(int, input().split(","))
    alist.append(a)
    blist.append(b)

ans = [0] * w

for i in range(1, w+1):
    position = i
    for a, b in zip(alist, blist):
        if a == position:
            position = b
        elif b == position:
            position = a

    ans[position-1] = i

for a in ans:
    print(a)

Python: # -*- coding:utf-8 -*-
import sys

w = int(input())
n = int(input())

array = []
count = 0
for i in sys.stdin:
    array.append(i)
    count += 1
    if count == n:
        break

a, b = [0]*n, [0]*n
for i in range(n):
    s = array[i]
    a[i], b[i] = s[0], s[2]
    a[i], b[i] = int(a[i]), int(b[i])

lines = []
k = 0
for i in range(w):
    lines.append(k)
    k += 1 

for i in range(n):
    tmp1 = lines[a[i]-1]
    tmp2 = lines[b[i]-1]
    lines[a[i]-1] = tmp2
    lines[b[i]-1] = tmp1

for i in range(len(lines)):
    print(lines[i]+1)

Python: w = int(input())
n = int(input())
l = list(range(1, w + 1))
for i in range(n):
    a, b = map(int, input().split(','))
    a -= 1
    b -= 1
    l[a], l[b] = l[b], l[a]

for i in range(w):
    print(l[i])

Python: a=int(input())
b=int(input())
c=range(1,b+1)
for i in range(a):
    d,e=map(int,raw_input().split())
    c[d],c[e]=c[e],c[d]
for i in c:print(i)

Python: a = list(map(lambda x: x+1, range(int(input()))))
for _ in range(int(input())):
    m,n = map(lambda x: int(x)-1, input().split(','))
    a[m], a[n] = a[n],a[m]
for i in a:
    print(i)

Python: import sys
f = sys.stdin
w = int(f.readline())
lots = [i + 1for i in range(w)]


n = int(f.readline())
for _ in range(n):
    a, b = map(int , f.readline().split(','))
    lots[a - 1], lots[b - 1] = lots[b - 1], lots[a - 1]

for i in lots:
    print(i)

Python: w = int(input())
wa = list(range(w+1))
n = int(input())
for _ in range(n):
    a,b = map(int, input().split(","))
    wa[a],wa[b] = wa[b],wa[a]
for s in wa[1:]:
    print(s)

Python: w = int(input())
n = int(input())
vertical = [x for x in range(1, w + 1)]

for i in range(n):
    a, b = [int(x) - 1 for x in input().split(',')]
    vertical[a], vertical[b] = vertical[b], vertical[a]

for i in vertical:
    print(i)

Python: if __name__ == '__main__':
    w = int(input())
    result = [i + 1 for i in range(w)]

    n = int(input())

    permutations = []
    for _ in range(n):
        permutations.append(map(lambda x: int(x) - 1, input().split(',')))

    for i, j in permutations:
        result[j], result[i] = result[i], result[j]

    print("\n".join(map(str, result)))

Python: import sys
n = int(sys.stdin.readline().rstrip())
m = int(sys.stdin.readline().rstrip())
l = []
for i in range(m):
    l.append(list(map(int, sys.stdin.readline().rstrip().split(','))))
print(l)
for i in range(n):
    cur = i+1
    for d in l[::-1]:
        if cur in d:
            cur = d[0] if cur == d[1] else d[1]
    print(cur)

Python: w = int(input())
n = int(input())

c = list(range(0, w+1))
for i in range(n):
    a, b = map(int, input().split(','))
    c[a], c[b] = c[b], c[a]

for i in range(1, w + 1):
    print(c[i])

Python: n=int(input())
k=int(input())

li=[]
for i in range(1, n+1):
    li.append(i)
    
#print(li)
for i in range(k):
    x=list(map(int,input().split(",")))
    li[x[0]-1]^=li[x[1]-1]
    li[x[1]-1]^=li[x[0]-1]
    li[x[0]-1]^=li[x[1]-1]
    #print(*li)
    
for i in range(n):
    print(li[i])

Python: def main():
    w = int(input())
    n = int(input())
    ans =[i for i in range(1, w+1)]

    def change(li, a, b):
        tmp = li[a-1]
        li[a-1] = li[b-1]
        li[b-1] = tmp
        return li

    for _ in range(n):
        a, b = map(int, input().split(","))
        ans = change(ans, a, b)
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

Python: a=[int(i+1) for i in range(int(input()))]
for i in range(int(input())):
    b,c=map(int,input().split(','))
    a[b-1],a[c-1]=a[c-1],a[b-1]
for i in a:print(i)