Go: package main

import (
        "fmt"
)

const MAX_N = 31
var lines [MAX_N]int

func main() {
        var n, w int
        fmt.Scanf("%d", &n)
        fmt.Scanf("%d", &w)

        Init()
        var l, r int
        for {
                _, err := fmt.Scanf("%d,%d", &l, &r)
                if err != nil {
                        break
                }

                Swp(l, r)
        }

        for i := 1; i <= n; i++ {
                fmt.Printf("%d\n", lines[i])
        }
}

func Swp(l int, r int) {
        var s int
        s = lines[l]
        lines[l] = lines[r]
        lines[r] = s
}

func Init() {
        for i := 0; i < MAX_N; i++ {
                lines[i] = i
        }
}

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


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

    print(*l, sep='\n')

if __name__ == '__main__':
    w = int(input())
    n = int(input())
    solve(w, n)

Python: w = int(input())
n = int(input())
nums = [1, 2, 3, 4, 5]
ab = []
for i 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)

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

Python: w, n = int(input()), int(input())
p = list(range(1, w + 1))
l = [list(map(int, input().split(","))) for i in range(n)]
for j in l: p[j[0] - 1], p[j[1] - 1] = p[j[1] - 1], p[j[0] - 1]
k = [print(v) for v in p]

Python: # coding: utf-8
w=int(input())
L=[i for i in range(1,w+1)]
n=int(input())
for i in range(n):
    a,b=[int(j)-1 for j in input().split(",")]
    s=L[a]
    L[a]=L[b]
    L[b]=s
[print(i) for i in L]

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())

A = list()
B = list()

S = [i for i in range(1, w + 1)]
G = [0 for i in range(w)]

for i in range(n) :
    a , b = map(int, input().split(","))
    A.append(a)
    B.append(b)
    
for i in range(1, w + 1) :
    g = i
    for j in range(n) :
        if(A[j] == g) :
            g = B[j]
        elif(B[j] == g) :
            g = A[j]
        else :
            pass
    G[g - 1] = i
    
for i in range(w) :
    print(G[i])

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

Python: import sys

lines = sys.stdin.readlines()
w = lines[0]
n = lines[1]
exchanges = lines[2:len(lines)]

ret = list(range(1,int(w)+1))

for line in exchanges:
    line = line.split(",")
    inp = []
    for i in line:
        inp.append(int(i))
    ret[inp[0]-1],ret[inp[1]-1] = ret[inp[1]-1],ret[inp[0]-1]

for i in ret:
    print (i)

Python: 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: w = int(input())
lots = [i for i in range(w)]
n = int(input())

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

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

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: ans=list(range(1,int(input())+1))
for i in range(int(input())):
    a,b=map(lambda x: int(x)-1,input().split(","))
    ans[a],ans[b]=ans[b],ans[a]
for i in ans:
    print(i)

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

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

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

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]))
print(a)
print(b)

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: 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: 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: stick = [i for i in range(1, int(input()) + 1)]

net = int(input())

for _ in range(net):
    a, b = list(map(int, input().split(",")))
    stick[a - 1], stick[b - 1] = stick[b - 1], stick[a - 1]
for v in stick:
    print(v)

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

amida = []
amida.append(-1)
for i in range(w):
    amida.append(i)

for l in range(n):
    a,b = [int(i) for i in input().split(",")]
    tmp = amida[a]
    amida[a] = amida[b]
    amida[b] = tmp

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

Python: # -*- coding: utf-8 -*-
 
import sys
 
def amida(w, side_bar):
    result = []
    side_bar.reverse()
    for x in range(1, w+1):
        status = x
        for bar in side_bar:
            if status == bar[0]:
                status = bar[1]
            elif status == bar[1]:
                status = bar[0]
        result.append(status)
    return result
 
def main():
    W = int(input())
    N = int(input())
    side_bar = [tuple(map(int, input().split(','))) for line in range(N)]
    result = amida(W, side_bar)
    for r in result:
        print(r)
 
if __name__ == '__main__':
    main()

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


def solve():
    w = int(input())
    n = int(input())
    l = [i for i in range(1, w+1)]

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

    print(*l, sep='\n')

solve()

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

L = list(range(1,w+1))

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

for i in L:
    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: #!/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())

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

for i in wlst:
    print(i)

Python: li = [i for i in range(int(input())+1)]
for i in range(int(input())):
    line = list(map(int, input().split(',')))
    li[line[0]],li[line[1]] = li[line[1]],li[line[0]]
for i in li[1::]: print(i)