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: import sys
w = int(input())
n = int(input())
l = list()
for _ in range(n):
    l.append(list(map(int,input().split(","))))

res = [0 for _ in range(w)]
for i in range(1,w+1):
    tgt = i
    for num in l:
        if tgt in num:
            if num.index(tgt) == 1:
                tgt = num[0]
            else:
                tgt = num[1]
    res[tgt-1] = i

for x in res:
    print(x)

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

for i in range(w):
    print(nums[i])

Python: w = int(input())
n = int(input())
array = [[i for i in input().split(",")]for i in range(n)]
a = -1
b = 1
c = False
d = [0 for i in range(w)]
for i in range(w):
    for i2 in range(n):
        if (i+1 == int(array[i2][0]) or i+1 == int(array[i2][1])) and a == -1:
            a = i2
            if i+1 == int(array[i2][0]):
                b = int(array[i2][1])
            else:
                b = int(array[i2][0])
            c = True
        if c and a < i2 and (b == int(array[i2][0]) or b == int(array[i2][1])):
            a = i2
            if b == int(array[i2][0]):
                b = int(array[i2][1])
            else:
                b = int(array[i2][0])
    d[b-1] = i+1
    a = -1
    b = i+1
    c = False
for i in range(w):
    print(d[i])

Python: w = int(input())
n = int(input())
Ami = []
Num = []
for i in range(n):
    Ami.append(list(map(int,input().split(","))))
print(Ami)
for i in range(1,w+1):
    pos = i
    for j in range(n):
        if pos == Ami[j][0]:
            pos = Ami[j][1]
        elif pos == Ami[j][1]:
            pos = Ami[j][0]
    Num.append([pos,i])
Num = sorted(Num)
for k in range(0,w):
    print(Num[k][1])

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]
[print(s)for s in a if s]

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

amida = []

for i in range(0,w+1):
    amida.append(i)
    
for i in range(n):
    ai,bi = map(int,input().split())
    aa = amida[ai]
    bb = amida[bi]
    amida[ai] = bb
    amida[bi] = aa
    
for i in range(1,w+1):
    print(w[i])

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

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

def swap(nlist,i,j):
    temp = nlist[i-1]
    nlist[i-1] = nlist[j-1]
    nlist[j-1] = temp
    return nlist

nlist = [i+1 for i in range(w)]
for i in range(n):
    i,j = [int(a) for a in input().split(',')]
    swap(nlist,i,j)
for i in nlist:
    print(i)

Python: # coding=utf-8


def list_swap(given_list: list, swap_number1: int, swap_number2: int)-> list:
    return_list = given_list[:]
    memo = given_list[swap_number1 - 1]
    return_list[swap_number2 - 1] = memo
    memo = given_list[swap_number2 - 1]
    return_list[swap_number1 - 1] = memo
    return return_list


if __name__ == '__main__':
    w = int(input())
    amida_number = [i for i in range(1, w+1)]
    n = int(input())
    for j in range(n):
        a, b = map(int, input().split(','))
        amida_number = list_swap(amida_number[:], a, b)
    [print(amida_number[k]) for k in range(w)]

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: w = int(input())
n = int(input())
am = [i for i in range(w+1)]
for _ in range(n):
    a, b = map(int, input().split(','))
    am[a], am[b] = am[b], am[a]
print(*am[1:], sep="\n")

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

Python: w = int(input())
n = int(input())
Ami = []
Num = []
for i in range(n):
    Ami.append(list(map(int,input().split(","))))
for i in range(1,w+1):
    pos = i
    for j in range(n):
        if pos == Ami[j][0]:
            pos = Ami[j][1]
        elif pos == Ami[j][1]:
            pos = Ami[j][0]
    Num.append([pos,i])
Num = sorted(Num)
for k in range(0,w):
    print(Num[k][1])

Python: def run():
    w = [i + 1 for i in range(int(input()))]
    n = int(input())
    for _ in range(n):
        s1, s2 = list(map(int, input().split(',')))
        w[s1-1], w[s2-1] = w[s2-1], w[s1-1]
    print('\n'.join([str(_w) for _w in w]))

if __name__ == '__main__':
    run()

Python: a=[i+1 for i in range(int(input()))]
for _ in[0]*int(input()):
 s,t=map(int,input().split(','))
 a[s],a[t]=a[t],a[s]
for s in a:print(s+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: 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: #空リストと1~入力値までの数字を入れたリストを作成する
line = []
for i in range(1,int(input()) + 1):line.append(i)

#何処と何処を交換するかを入力し交換する
for _ in range(int(input())):
    a,b = map(int,input().split(","))
    line[a - 1],line[b - 1] = line[b - 1],line[a - 1]
    
#出力
for s in line:print(s)

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

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

# Copyright  : @Huki_Hara
# Created    : 2015-03-01

s=[]
W=int(input())
n=int(input())
for i in range(W):
    s.append(i+1)

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

amida = []

for i in range(0,w+1):
    amida.append(i)
    
for i in range(n):
    ai,bi = map(int,input().split(","))
    aa = amida[ai]
    bb = amida[bi]
    amida[ai] = bb
    amida[bi] = aa
    
for i in range(1,w+1):
    print(amida[i])

Python: import sys
import math as mas

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

#for i in sys.stdin:
#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

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