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: def main():
    LIST=[]
    for i in range(int(input())):
        LIST.append(i+1)

    for j in range(int(input())):
        a,b=map(int,input().split(","))
        LIST[a-1],LIST[b-1]=LIST[b-1],LIST[a-1]

    for i in LIST:
        print(str(i))
            
    
if __name__ == '__main__':
    main()

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

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

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

array = []
for i in range(n):
    array.append(input())

a, b = [], []
for i in range(n):
    s = array[i]
    a.append(s[0])
    b.append(s[1])
    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: a=[i+1 for i in range(int(input()))]
for _ in[0]*int(input()):
 s,t=map(lambda x:int(x)-1,input().split(','))
 a[s],a[t]=a[t],a[s]
print(*a,sep='\n')

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

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

    _a = nums[a]
    nums[a] = nums[b]
    nums[b] = _a
print("\n".join([str(n) for n in nums]))

Python: w = int(input())
n = int(input())
l = [list(map(int, input().split(','))) for x in range(n)]

res = [0] * (w + 1)
for i in range(1, w + 1):
    c = i
    for a in l:
        if a[0] == c:
            c = a[1]
        elif a[1] == c:
            c = a[0]

    res[c] = i

for r in res[1:]:
    print(r)

Python: import math
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: w = int(input())
n = int(input())

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

for i in range(n):
    try:
        a, b = list(map(lambda x:int(x)-1, input().split(",")))
    except EOFError:
        break
    nums[a], nums[b] = nums[b], nums[a]

for i in nums:
    print(i)

Python: # AOJ 0009 Prime Number
# Python3 2018.6.9 bal4u

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

for i in range(1, w+1):
    print(s[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:
 if s:print(s+1)

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

Python: W = int(input())
N = int(input())
edges = [tuple(map(lambda c:int(c)-1, input().split(","))) for _ in [0]*N]
result = list(range(1, W+1))

for a, b in edges:
    result[a], result[b] = result[b], result[a]

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

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: w = int(input())
c = [i for i in range(1, w + 1)]
n = int(input())
for i in range(n):
  a, b = map(int, input().split(","))
  r = c[a - 1]
  c[a - 1] = c[b - 1]
  c[b - 1] = r
for i in range(w):
  print(c[i])

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

Python: list = {}
for a in range(1, int(input()) + 1) : list[a] = a
for a in range(int(input())) :
    x, y = [int(temp) for temp in input().split(',')]
    temp = list[x]
    list[x] = list[y]
    list[y] = temp
for a in range(1, len(list) + 1) : print(list[a])

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

Python: user = input()
w = int(user)
user = input()
n = int(user)
a = []
b = []
now = 0
for i in range(n):
    user = input()
    users = user.split(",")
    a.append(int(users[0]))
    b.append(int(users[1]))

for j in range(1, w+1):
    now = j
    for k in reversed(range(n)):
        if now == a[k]:
            now = b[k]
        elif now == b[k]:
            now = a[k]
    print(now)

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

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)]
print(len(result))

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 = int(input())
n = int(input())
l = list(reversed([list(map(int, input().split(','))) for x in range(n)]))

for i in range(1, w + 1):
    c = i
    for a in l:
        if a[0] == c:
            c = a[1]
        elif a[1] == c:
            c = a[0]

    print(c)

Python: w = int(input())
n = int(input())
lines = []
for i in range(n):
    a, b = map(int, input().split(","))
    lines.append([a, b])
lines = list(reversed(lines))
for j in range(1, w + 1):
    for line in lines:
        if line[0] == j:
            j = line[1]
        elif line[1] == j:
            j = line[0]
    print(j)

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(','))))
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: if __name__ == '__main__':
    w = int(input())
    n = int(input())
    lst = []
    anslst = [0 for i in range(w)]
    for i in range(n):
        a, b = map(int, input().split(','))
        lst.append((a,b))
    for i in range(1,w+1):
        x = i 
        for (f,s) in lst:
            if f == x:
                x = s
            elif s == x:
                x = f
        anslst[x-1] = i
    for n in anslst:
        print(n)

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

Python: w = int(input())
n = int(input())
kuji = [i+1 for i in range(w)]
for _ in range(n):
    a, b = map(int, input().split(','))
    kuji[a-1], kuji[b-1] = kuji[b-1], kuji[a-1]
print(*kuji, sep="\n")