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

Python: def main():
    n = int(input())
    point = int(input())
    A = []
    for i in range(n):
        A.append(i+1)
    for i in range(point):
        a,b = map(int,input().split(","))
        A[a-1],A[b-1] = A[b-1],A[a-1]
    for value in A:
        print(value)
      


if __name__ == '__main__':
    main()

Python: a=[int(i+1) for i in range(int(input()))]
for i in range(int(input())):
    b,c=map(int,input().split(','))
    a[b-1],a[c-1]=a[c-1],a[b-1]
for i in a: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 = list(range(1,int(raw_input())+1))
for i in range(int(raw_input())):
	a,b = map(int,raw_input().split(','))
	w[a-1], w[b-1] = w[b-1], w[a-1]
print('\n'.join(map(str,w)))

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
	int h[31]={},w=0,hh,ww,a,b,i;
	cin >> hh;
	for(i=1;i<=hh;i++){
		h[i] = i;
	}
	cin >> ww;
	for(i=1;i<=ww;i++){
		scanf("%d,%d",&a,&b);
		swap(h[a],h[b]);
	}
	for(int i=1;i<=hh;i++){
		cout << h[i] << endl;
	}
	return 0;
}

C++: /*AOJ 0011*/

#include<iostream>
#include<vector>

using namespace std;

int main(){
	int w,n;

	cin>>w;
	cin>>n;

	vector<int> a;
	vector<int> b;

	int ans[30];

	for(int i=0;i<n;i++){
		int tmp1,tmp2;
		cin>>tmp1;
		cin>>tmp2;
		a.push_back(tmp1-1);
		b.push_back(tmp2-1);
	}
	/*
	for(int i=0;i<n;i++){
		cout<<a[i]<<" "<<b[i]<<endl;
	}
	*/

	for(int i=0;i<w;i++){
		int point = i;

		for(int j=0;j<n;j++){
			if(point==a[j]){
				point = b[j];
			}
			else if(point==b[j]){
				point = a[j];
			}
		}
		ans[point] = i+1;
	}

	for(int i=0;i<w;i++){
		cout<<ans[i]<<endl;
	}

	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cstdio>
#include<utility>
using namespace std;

int main(){
    int w, n;
    cin >> w >> n;

    vector<int> ans;
    for(int i = 0 ; i <= w ; ++i){
        ans.emplace_back(i);
    }

    for(int i = 0 ; i < n ; ++i){
        int a, b;
        char c;
        cin >> a >> c >> b;
        swap(ans[a], ans[b]);
    }

    for(int i = 1 ; i <= w ; ++i){
        cout << ans[i] << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
long gcd(long n,long m){
	if (m == 0) return n;
	return gcd(m, n % m);
}

long lcm(long n, long m) {
	return m / gcd(n, m)*n;
}

int main(void) {
	int w, n, a, b, tmp;
	int ans[30];
	for (int i = 0; i < 30; i++)
		ans[i] = i + 1;
	scanf("%d\n%d", &w, &n);
	for (int i = 0; i < n; i++) {
		scanf("%d,%d", &a, &b);
		tmp = ans[a - 1];
		ans[a - 1] = ans[b - 1];
		ans[b - 1] = tmp;
	}
	for (int i = 0; i < w; i++)
		cout << ans[i] << endl;
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int w,n;
	cin>>w>>n;

	int nums[w];
	for(int i=0;i<w;i++){
		nums[i]=i+1;
	}

	for(int i=0;i<n;i++){
		int a1,b1;
		char dummy;
		cin>>a1>>dummy>>b1;
		a1--;b1--;
		int tmp=nums[b1];
		nums[b1]=nums[a1];
		nums[a1]=tmp;
	}

	for(int i=0;i<w;i++){
		cout<<nums[i]<<"\n";
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
#include <iterator>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i, a, cont, next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i, a, b, step) repfn(i, a, i < b, i + step)
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

int main(int argc, char **argv)
{
  int w, n, a, b;
  char c;
  vi v;

  cin >> w;
  rep (i, w + 1) {
    v.pb(i);
  }

  cin >> n;
  while (n--) {
    cin >> a >> c >> b;
    swap(v[a], v[b]);
  }
  repab (i, 1, w + 1) {
    cout << v[i] << endl;
  }

  return 0;
}

C++: #include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int w;
	cin >> w;

	vector<int> lines;
	for(int i = 1; i <= w; i++)
		lines.push_back(i);

	int n;
	cin >> n;

	for(int i = 0; i < n; i++)
	{
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(lines[a-1], lines[b-1]);
	}

	for(auto line : lines)
		cout << line << endl;

	return 0;
}