Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	w := nextInt()
	n := nextInt()

	numbers := make([]int, w+1)
	for i := 1; i <= w; i++ {
		numbers[i] = i
	}

	for i := 0; i < n; i++ {
		line := nextString()
		words := strings.Split(line, ",")
		a, _ := strconv.Atoi(words[0])
		b, _ := strconv.Atoi(words[1])

		numbers[a], numbers[b] = numbers[b], numbers[a]
	}

	for i := 1; i <= w; i++ {
		fmt.Println(numbers[i])
	}
}

Python: w=int(input())
n=int(input())
lst=[i+1 for i in range(w)]
for i in range(n):
    x,y=map(int,input().split(","))
    lst[x-1],lst[y-1]=lst[y-1],lst[x-1]
for i in lst:print(i)

Python: def get_another_num(data, me):
    if data[0] == me:
        return data[1]
    else:
        return data[0]


if __name__ == '__main__':
    # ??????????????\???
    #v_lines = 5
    #h_lines = 4
    #data = [(2, 4), (3, 5), (1, 2), (3, 4)]
    v_lines = int(input())
    h_lines = int(input())
    data = []
    for i in range(h_lines):
        data.append(tuple(map(int, input().split(','))))


    # ????????????????????????
    results = [0] * (v_lines + 1)
    for i in range(1, v_lines + 1):
        me = i
        for amida in data:
            if me in amida:
                me = get_another_num(amida, me)
        results[me] = i

    # ???????????¨???
    for i in range(1, v_lines + 1):
        print(results[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)