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: # 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])

Python: def play():
    result_dic = {}    
    for i in range(tate):
        depart = i+1
        arrival = drawing_lots[depart][0]
        arrival = aaa(depart, arrival)
        result_dic[arrival] = depart
    
    for k in sorted(result_dic):
        print(result_dic[k])

def aaa(depart, arrival):
    offset = 0
    for point in drawing_lots[arrival]:
        if point == depart:
            break
        offset += 1
    
    if offset+1 <= len(drawing_lots[arrival])-1:
        depart = arrival
        arrival = drawing_lots[arrival][offset+1]
        return aaa(depart, arrival)
    else:
        return arrival
        
tate = int(raw_input())
yoko = int(raw_input())

drawing_lots = {}
for num in range(tate):
    drawing_lots[num+1] = []
    
for i in range(yoko):
    horizontal_line = raw_input().split(',')
    left_num = int(horizontal_line[0])
    right_num = int(horizontal_line[1])
    drawing_lots[left_num].append(right_num)
    drawing_lots[right_num].append(left_num)

play()

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]
    print(stick)
print("\n".join(map(str, stick)))