Go: package main

import "fmt"

func main() {
	var w, n, a, b, i, te int
	var amida [31]int
	fmt.Scanf("%d", &w)
	fmt.Scanf("%d", &n)
	for i := 1; i <= w; i++ {
		amida[i] = i
	}
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d,%d", &a, &b)
		te = amida[a]
		amida[a] = amida[b]
		amida[b] = te
	}
	for i := i; i <= w; i++ {
		fmt.Printf("%d\n", amida[i])
	}
}

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

amida = []

for i in range(0,w+1):
    amida.append(i)
    
for i in range(n):
    ai,bi = map(int,input().split())
    aa = amida[ai]
    bb = amida[bi]
    amida[ai] = bb
    amida[bi] = aa
    
for i in range(1,w+1):
    print(w[i])

Python: w = int(raw_input())
n = int(raw_input())
l = [i for i in range(1,w+1)]
while n > 0:
  a,b = map(int,raw_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())

def swap(nlist,i,j):
    temp = nlist[i-1]
    nlist[i-1] = nlist[j-1]
    nlist[j-1] = temp
    return nlist

nlist = [i+1 for i in range(w)]
for i in range(n):
    i,j = [int(a) for a in input().split(',')]
    swap(nlist,i,j)
for i in nlist:
    print(i)

Python: # coding=utf-8


def list_swap(given_list: list, swap_number1: int, swap_number2: int)-> list:
    return_list = given_list[:]
    memo = given_list[swap_number1 - 1]
    return_list[swap_number2 - 1] = memo
    memo = given_list[swap_number2 - 1]
    return_list[swap_number1 - 1] = memo
    return return_list


if __name__ == '__main__':
    w = int(input())
    amida_number = [i for i in range(1, w+1)]
    n = int(input())
    for j in range(n):
        a, b = map(int, input().split(','))
        amida_number = list_swap(amida_number[:], a, b)
    [print(amida_number[k]) for k in range(w)]

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

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

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

Python: w = int(input())
n = int(input())
Ami = []
Num = []
for i in range(n):
    Ami.append(list(map(int,input().split(","))))
for i in range(1,w+1):
    pos = i
    for j in range(n):
        if pos == Ami[j][0]:
            pos = Ami[j][1]
        elif pos == Ami[j][1]:
            pos = Ami[j][0]
    Num.append([pos,i])
Num = sorted(Num)
for k in range(0,w):
    print(Num[k][1])

Python: def run():
    w = [i + 1 for i in range(int(input()))]
    n = int(input())
    for _ in range(n):
        s1, s2 = list(map(int, input().split(',')))
        w[s1-1], w[s2-1] = w[s2-1], w[s1-1]
    print('\n'.join([str(_w) for _w in w]))

if __name__ == '__main__':
    run()

Python: a=[i+1 for i in range(int(input()))]
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: 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: tate =int(raw_input())
yoko=int(raw_input())
arr = [i+1 for i in range(tate)]
for j in range(yoko):
    rep1,rep2=raw_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: #空リストと1~入力値までの数字を入れたリストを作成する
line = []
for i in range(1,int(input()) + 1):line.append(i)

#何処と何処を交換するかを入力し交換する
for _ in range(int(input())):
    a,b = map(int,input().split(","))
    line[a - 1],line[b - 1] = line[b - 1],line[a - 1]
    
#出力
for s in line:print(s)

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

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

# Copyright  : @Huki_Hara
# Created    : 2015-03-01

s=[]
W=int(input())
n=int(input())
for i in range(W):
    s.append(i+1)

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

for i in s:
    print(i)

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

amida = []

for i in range(0,w+1):
    amida.append(i)
    
for i in range(n):
    ai,bi = map(int,input().split(","))
    aa = amida[ai]
    bb = amida[bi]
    amida[ai] = bb
    amida[bi] = aa
    
for i in range(1,w+1):
    print(amida[i])

Python: import sys
import math as mas

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

#for i in sys.stdin:
#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

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

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: n = int(input())
h = int(input())
arr = list(range(1, n + 1))
for _ in range(h):
    a, b = map(int, input().split(','))
    arr[a - 1], arr[b - 1] = arr[b - 1], arr[a - 1]
for ai in arr:
    print(ai)

Python: w = int(input())
n = int(input())
lst = [i + 1 for i in range(w)]
def swap(t):
  a,b = t
  temp = lst[a-1]
  lst[a-1] = lst[b-1]
  lst[b-1] = temp
for i in range(n):
  swap(tuple(map(int,input().split(","))))
for i in range(w):
  print(lst[i])

Python: #!/usr/bin/env python3
def main():
    w = int(input())
    n = int(input())
    nums = list(range(1, w + 1))
    for _ in range(n):
        a, b = map(int, input().split(','))
        nums[a - 1], nums[b - 1] = nums[b - 1], nums[a - 1]
    for i in nums:
        print(i)
if __name__ == '__main__':
    main()

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

Python: w = int(input())
n = int(input())
l = list(range(1,w+1))

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

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

Python: w=int(input())
num=[i+1 for i in range(w)]
n=int(input())
for i in range(n):
	data=list(map(int,input().split(",")))
	a=num[data[0]-1]
	num[data[0]-1]=num[data[1]-1]
	num[data[1]-1]=a
for i in range(w):
	if i==w-1:
		print(num[i],end="\n")
	else:
		print(num[i])