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())
lv = [i for i in range(1, w+1)]

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

for v in lv:
    print(v)

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

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(','))
        l[a], l[b] = l[b], l[a]

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

solve()

Python: W = int(input());#list(map(int, input().split()))
N = int(input());#list(map(int, input().split()))

field=[[-1 for i in range(W)] for j in range(N)]

for i in range(N):
	a,b=list(map(int, input().split(',')))
	field[i][a-1]=b-1;
	field[i][b-1]=a-1;

result=[0 for i in range(W)];
for i in range(W):
	now=i;
	for j in range(N):
		if(field[j][now]!=-1):
			now=field[j][now];
	result[now]=i+1;

for i in result:
	print(i);

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

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

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=input()
l=[i+1 for i in range(w)]
n=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 w:
    print(i)

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

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: v = int(input())
h = int(input())

l = [i for i in range(1, v + 1)]
for i in range(h):
    n, m = input().split(',')
    n = int(n) - 1
    m = int(m) - 1
    l[n], l[m] = l[m], l[n]

for i in l:
    print(i)

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

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

array = []
for i in range(n):
    array.append(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: data = []
w = int(input())
for i in range(w):
  data.append(i+1)

n = int(input())

for line in range(n):
  a, b = [int(i) for i in input().split(',')]
  data[a-1], data[b-1] = data[b-1], data[a-1]
for d in data:
  print(d)

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 w:
    print(i)

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

l = list(range(w + 1))

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

print('\n'.join([str(i) for i in l[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: #import math

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

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

Python: from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

L = [i + 1 for i in xrange(int(stdin.readline()))]
for _, line in zip(xrange(int(stdin.readline())), stdin):
    a, b = (int(t) - 1 for t in line.split(','))
    L[a], L[b] = L[b], L[a]
for i in L:
    print(i)

Python: a=int(input())
b=int(input())
c=range(1,b+1)
for i in range(a):
    d,e=map(int,raw_input().split())
    c[d],c[e]=c[e],c[d]
[print(i) for i in c]

Python: w = int(input())
n = int(input())
nums = list(range(w + 1))
for i in range(n):
    s = list(map(int, input().split(", ")))
    nums[s[0]], nums[s[1]] = nums[s[1]], nums[s[0]]
for j in range(w):
    print(nums[j + 1])

Python: w = list(range(1,int(raw_input())+1))
for i in range(int(raw_input())):
	a,b = map(int,raw_input().split(','))
	t = w[a-1]
	w[a-1] = w[b-1]
	w[b-1] = t
print('\n'.join(map(str,w)))

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

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

Python: w = int(input())
n = int(input())
a = [[int(i) for i in input().split(",")] for j in range(n)]
b = [0 for i in range(w)]
for i in range(1, w+1):
    next_num = i
    for j in a:
        if next_num == j[0]:
            next_num = j[1]
        elif next_num == j[1]:
            next_num = j[0]
    b[next_num - 1] = i
for i in range(w):
    print(b[i])

Python: a=int(input())
b=int(input())
c=range(1,b+1)
for i in range(a):
    d=str(raw_input())
    c[int(d[0])],c[int(d[-1])]=c[int(d[-1])],c[int(d[0])]
for i in c:print(i)

Python: import sys

lines = str(sys.stdin.read()).strip().split("\n")
W = int(lines.pop(0))
N = int(lines.pop(0))

results = list(range(1,W + 1))

for i in range(N):
    data = list(map(lambda i: int(i) - 1, lines[i].split(",")))
    results[data[0]], results[data[1]] = results[data[1]], results[data[0]]

for result in results:
	print(result)

Python: a=int(input())
b=int(input())
c=range(1,b+1)
for i in range(a):
    d=str(raw_input())
    c[int(d[0]-1)],c[int(d[-1]-1)]=c[int(d[-1]-1)],c[int(d[0]-1)]
for i in c:print(i)

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

amida = [i for i in range(w)]

for i in range(n):
    a = input().rstrip().split(",")
    number = [int(i) - 1 for i in a]
    amida[number[0]], amida[number[1]] = amida[number[1]], amida[number[0]]

for i in amida:
    print(i + 1)

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

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

for i in ans:
    print(i+1)