Go: package main

import "fmt"

func main() {
	var w, n int
	fmt.Scan(&w)
	numbers := make([]int, w)

	fmt.Scan(&n)

	intersect := make([][2]int, n)

	for i := 0; i < n; i++ {
		var x, y int
		fmt.Scanf("%d,%d", &x, &y)
		intersect[i] = [2]int{x, y}
	}

	for i := 0; i < w; i++ {
		numbers[i] = i + 1
	}

	for _, v := range intersect {
		swap(numbers, v[0], v[1])
	}

	for _, v := range numbers {
		fmt.Println(v)
	}
}

func swap(arr []int, x, y int) {
	tmp := arr[x-1]
	arr[x-1] = arr[y-1]
	arr[y-1] = tmp
}

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

amida = [i for i in range(w)]

for i in range(n):
    a = input().rstrip().split(",")
    number = [int(i) - 1 for i in a]
    amida[number[0]], amida[number[1]] = amida[number[1]], amida[number[0]]

for i in amida:
    print(i + 1)

Python: #!/usr/bin/env python
# -*- coding:utf-8 -*-
w = int(input())
n = int(input())
v_lines = [i for i in range(1,w+1)]
for i in range(n):
    a,b = list(map(int, input().split(',')))
    t = v_lines[a-1]
    v_lines[a-1] = v_lines[b-1]
    v_lines[b-1] = t
for i in range(len(v_lines)):
    print(v_lines[i])

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

ans = [i for i in range(w)]
for i in range(n):
    a,b = list(map(int, input().split(",")))
    temp = ans[a-1]
    ans[a-1] = ans[b-1]
    ans[b-1] = temp

for i in ans:
    print(i+1)

Python: w = int(input().replace("\n", ""))
n = []
for i in range(int(input().replace("\n", ""))):
    n.append([int(v) for v in input().replace("\n", "").split(",")])

m = [0] * (w + 1)
for i in range(1, w + 1):
    step = i
    for j in range(0, len(n)):
        if n[j][0] == step:
            step = n[j][1]
        elif n[j][1] == step:
            step = n[j][0]
    m[step] = i
del m[:1]
print("\n".join(map(str, m)))

Python: w=eval(input())
n=eval(input())
edge=[]
for i in range(n):
    edge.append(tuple(map(int,input().split(','))))
for i in range(1,w+1):
    temp=i
    for j in range(n):
        if temp in edge[n-j-1]:
            temp=edge[n-j-1][edge[n-j-1].index(temp)-1]
    print(temp)

Python: #!/usr/bin/env python3
# -*- coding: utf-8 -*-



def main():
    w = int(input())
    n = int(input())

    xs = [i for i in range(w+1)]
    for _ in range(n):
        a, b = map(int, input().split(","))

        xs[a], xs[b] = xs[b], xs[a]

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

if __name__ == "__main__": main()

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

amida = [i for i in range(1, w + 1)]
for _ in range(n):
    a, b = [int(i) - 1 for i in input().split(",")]
    amida[a], amida[b] = amida[b], amida[a]

for x in amida:
    print(x)

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

for x in li:
    print(x)

Python: n = int(input())
m = int(input())
p = list(range(n+1))
for i in range(m):
    a, b = map(int, input().split(","))
    p[a], p[b] = p[b], p[a]

for v in p[1:]:
    print(v)

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

Python: arr = [i + 1 for i in range(int(input()))]
m = int(input())
for i in range(m):
    inp = list(map(int, input().split(",")))
    tmp = arr[inp[0] - 1]
    arr[inp[0] - 1] = arr[inp[1] - 1]
    arr[inp[1] - 1] = tmp
for i in range(len(arr)):
    print(arr[i])

Python: w = int(input())
n = int(input())
ans = [0 for i in range(w)]
list = []

for i in range(n):
    ll = input().split(",")
    a, b = ll[0], ll[1]
    a = int(a)
    b = int(b)
    list.append([a,b])

# print(list)
for i in range(1,w+1):
    position = i-1

    for ll in list:
        a, b = ll[0], ll[1]
        if position == a-1:
            position = b-1
        elif position == b-1:
            position = a-1
        else:
            pass
    ans[position] = i
for j in ans:
    print(j)

Python: #!/usr/bin/env python
#-*- coding:utf-8 -*-

import sys
import math

w = int(input())
n = int(input())
s = []

for _ in range(n):
    x = input().split(',')
    s.append((int(x[0]), int(x[1])))

result = [i for i in range(1, w+1)]

for x, y in s:
    result[x-1], result[y-1] = result[y-1], result[x-1]

for x in result:
    print(x)

Python: w = eval(input())
n = eval(input())
numlist = [item for item in range(1, w + 1)]
for t in range(n):
	i, j = [eval(item) - 1 for item in input().split(',')]
	numlist[i], numlist[j] = numlist[j], numlist[i]
for item in numlist:
	print(item)

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

Python: # coding: utf-8

w = int(raw_input())
n = int(raw_input())

yoko = []
for i in range(n):
	data = map(int, raw_input().split(","))
	yoko.append(data)

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

for num in range(1,w+1):
#	deb.printdebug1(num, debug)
	direction = num
	for c in yoko:
		if c[0] == direction:
#			deb.printdebug2(direction, debug)
#			deb.printdebug2(c[1], debug)
			direction = c[1]
		elif c[1] == direction:
#			deb.printdebug2(direction, debug)
#			deb.printdebug2(c[1], debug)
			direction = c[0]
	ans[direction-1] = num

for i in ans:
	print(i)

Python: a = []
b = []
numbers_s = []
numbers_g = []

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

for i in range(0, n):
    temp_a, temp_b = input().split(',')
    a.append(int(temp_a))
    b.append(int(temp_b))

for i in range(0, w):
    numbers_s.append(i+1)
    numbers_g.append(0)

for i in range(0, w):

    temp_idx = i+1

    for j in range(0, n):
        if temp_idx == a[j]: temp_idx = b[j]
        elif temp_idx == b[j]: temp_idx = a[j]

    numbers_g[temp_idx - 1] = i+1

for i in range(0, len(numbers_g)):
    print(numbers_g[i])

Python: w=list(range(int(input())))
sw=[list(map(int,input().split(","))) for i in range(int(input()))]
for i in sw:
    w[i[0]-1],w[i[1]-1]=w[i[1]-1],w[i[0]-1]
[print(i+1) for i in w]

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

for i in s:
    print(i)

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

Python: # coding: utf-8
w = int(input())
ans = [i + 1 for i in range(w)]
loop = int(input())

# swap
for _ in range(loop):
    left, right = map(int, input().split(","))
    ans[left-1], ans[right-1] = ans[right-1], ans[left-1]

# result
for i in ans:
    print(i)

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:print(s+1)

Python: import sys
w = int(input())
n = int(input())
l = list()
for _ in range(n):
    l.append(list(map(int,input().split(","))))

res = [0 for _ in range(w)]
for i in range(1,w+1):
    tgt = i
    for num in l:
        if tgt in num:
            if num.index(tgt) == 1:
                tgt = num[0]
            else:
                tgt = num[1]
    res[tgt-1] = i

for x in res:
    print(x)

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

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