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: 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]
print(A)

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

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

[print(b) for b in bs]

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: # coding=utf-8

###
### for atcorder program
###

import sys
import math
import array

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def main():

    W = int(input())
    N = int(input())
    AB = [[int(x)-1 for x in input().split(',')] for i in range(N)]
    
    ans = list(range(1, W+1))

    for ab in AB:
        ans[ab[0]], ans[ab[1]] = ans[ab[1]], ans[ab[0]]

    for i in ans:
        print(i)

if __name__ == '__main__':
    main()

Python: if __name__ == '__main__':

	line = int(input())
	A = [i+1 for i in range(line)]
	n = int(input())

	for _ in range(n):
		j,k = map(int,input().split(","))

		A[j-1],A[k-1] = A[k-1],A[j-1]

	for i in range(line):
		print(A[i])

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

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

array = [0]*n
for i in range(n):
    array[i] = input()

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

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

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

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())
Ver = list(range(1, w+1))

n = int(input())

for i in range(n):
    j, k = map(int, input().split(','))

    temp = Ver[j-1]
    Ver[j-1] = Ver[k-1]
    Ver[k-1] = temp

for i in range(len(Ver)):
    print(Ver[i])

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

import sys

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

lst = range(1, w+1)

for num in sys.stdin:
    nums = num.split(",")
    a1 = int(nums[0]) - 1
    b1 = int(nums[1]) - 1

    a2 = lst[a1]
    b2 = lst[b1]
    lst[a1] = b2
    lst[b1] = a2

for i in lst:
    print(i)

Python: # Aizu Problem 0011: Drawing Lots
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


         
w = int(input())
slots = list(range(1, w + 1))
n = int(input())
for k in range(n):
    a, b = [int(_) for _ in input().split(',')]
    slots[a-1], slots[b-1] = slots[b-1], slots[a-1]
for s in slots:
    print(s)

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

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

a = [None] * (n)
b = [None] * (n)
for i,line in enumerate(sys.stdin.readlines()):
   a[i], b[i] = map(int, line.split(","))

def swap(x, y):
    global state 
    temp = state[x-1]
    state[x-1] = state[y-1]
    state[y-1] = temp


for i in range(n):
    swap(a[i], b[i])

for x in state:
    print(x)

Python: 
if __name__ == '__main__':
    w = (int)(input())
    n = (int)(input())
    a = [i+1 for i in range(0,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 x in a:
        print(x)

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: w=int(input())
n=int(input())
a=[]
b=[]
Ans=[int(0) for i in range(w)]
for i in range(n):
    x,y=[int(j) for j in input().split(",")]
    a.append(x)
    b.append(y)
for i in range(1,w+1):
    ans=i
    for j in range(len(a)):
        if ans==a[j]:
            ans=b[j]
        elif ans==b[j]:
            ans=a[j]
    Ans[ans-1]=i
for i in range(w):
    print(Ans[i])