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])
	}
}

C++: #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;


int main()
{
    int w,n;
    cin>>w>>n;
    vector<int> act(w);
    for(int c=0;c<act.size();c++) act[c]=c+1;
    for(int c=0;c<n;c++)
    {
        string s;
        cin>>s;
        int a=0,b=0;
        int c2;
        for(c2=0;s[c2]!=',';c2++) {a*=10;a+=s[c2]-'0';}
        c2++;
        for(;c2<s.size();c2++) {b*=10;b+=s[c2]-'0';}

        swap(act[a-1],act[b-1]);
    }
    for(int c=0;c<w;c++) cout<<act[c]<<endl;
}

C++: 
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
#include<stdio.h>
using namespace std;
const int MAX = 100;
int main() {
	int W, N;
	int t[MAX];

	cin >> W >> N;
	for (int i = 0; i < W; i++) {
		t[i] = i;
	}
	for (int i = 0; i < N; i++) {
		int a, b;
		scanf("%d,%d", &a, &b); a--; b--;
		swap(t[a], t[b]);
	}
	for (int i = 0; i < W; i++) {
		printf("%d\n", t[i] + 1);
	}
	return 0;
}

C++: #include <iostream>

const int W_MAX = 30;
const int N_MAX = 30;

int w;
int n;
int a[N_MAX + 1];
int b[N_MAX + 1];
int out[W_MAX + 1];

void chenge(int *farst, int *second){
	int tmp;
	tmp = *farst;
	*farst = *second;
	*second = tmp;
}

int main(void){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);

	std::cin >> w;
	std::cin >> n;

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

	for(int i = 1; i <= n; i++){
		std::cin >> a[i] >> b[i];
		chenge(&out[a[i]], &out[b[i]]);
	}
	
	for(int i = 1; i <= w; i++){
		std::cout << out[i] << '\n';
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
  int w;
  while (cin >> w) {
    vector<int> vec;
    vec.resize(w);
    // default
    for (int i = 0; i < vec.size(); ++i) {
      vec[i] = i + 1;
    }
    int n = 3;
    for (int i = 0; i < n; ++i) {

    }
    for (int i = 0; i < vec.size(); ++i) {
      cout << vec[i] << endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <stdio.h>

int main() {
	int w; std::cin >> w;
	int W[w];
	for (int i=0; i<w; i++) W[i] = i+1;
	int n; std::cin >> n;
	int a, b, tmp;
	while (~scanf("%d,%d", &a, &b)) {
		tmp = W[a-1];
		W[a-1] = W[b-1];
		W[b-1] = tmp;
	}
	for (int i=0; i<w; i++) std::cout << W[i] << std::endl;
	return 0;
}

C++: #include<iostream>

int main(){
	int w,n,tate[31],yoko1,yoko2,i,j;
	char c;

	
	std::cin>>w>>n;
	for(i=1;i<=w;i++){
		tate[i]=i;
	}

	for(i=0;i<n;i++){
		std::cin>>yoko1>>c>>yoko2;
		j=tate[yoko1];
		tate[yoko1]=tate[yoko2];
		tate[yoko2]=j;
	}

	for(i=1;i<=w;i++){
		std::cout<<tate[i]<<std::endl;
	}

		
	
	
  return 0;
}

C++: #include <stdio.h>

using namespace std;

int main(){
    int w, n;
    int d[31];
    char s[30];
    while(~scanf("%d %d", &w, &n)){
        for(int i=1;i<=w;i++) d[i] = i;
        for(int i=0;i<n;i++){
            scanf("%s", s);
            int a, b;
            sscanf(s, "%d,%d", &a, &b);
            swap(d[a], d[b]);
        }
        for(int i=1;i<=w;i++) cout << d[i] << endl;
    }
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
#include <complex>
#include <cstring>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int n,m;
  cin>>n>>m;
  int w[30];
  rep(i,n)w[i] = i + 1;
  while(m--){
    int a,b;
    scanf("%d,%d",&a,&b);
    swap(w[--a],w[--b]);
  }
  rep(i,n)cout<<w[i]<<endl;
}

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

int main(){
  int a,b,m[35],c,e;
  string d;
  cin >>a>>b;
  for(int i=1;i<=a;i++)m[i]=i;
  for(int i=1;i<=b;i++){
    cin >>d;
    swap(m[d[0]-'0'],m[d[2]-'0']);
  }
  for(int i=1;i<=a;i++)cout<<m[i]<<endl;
  return 0;
}

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

int main() {
	vector<int>v;
	vector<int>::iterator pv=v.begin();
	int w, n;
	scanf("%d,%d", &w, &n);
	for (int i = 0; i < w; i++) {
		v.push_back(i + 1);
	}
	for (int i = 0; i < n; i++) {
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(v[a - 1], v[b - 1]);
	}
	for (int i = 0; i < w; i++) {
		cout << *pv << endl;
		pv++;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>

#define swap(a,b) a^=b^=a^=b

using namespace std;

typedef struct{
    int l;
    int r;
}tint;
int main(){
    
    vector<tint> lines;
    tint ins;
    int w,n;
    cin >> w >> n;
    int *ans = new int(w+1);

    for(int i=0;i<n;i++){
        scanf("%d,%d",&ins.l,&ins.r);
        lines.push_back(ins);
    }
    for(int i=0;i<=w;i++){
        ans[i]=i;
    }
    for(int i=0;i<n;i++){
        swap(ans[lines[i].l],ans[lines[i].r]);
    }

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

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

int main(void)
{
    int w, n;
    std::cin >> w >> n;

    std::vector<int> a(n), b(n);
    char temp;

    for(int i = 0; i < n; ++i)
    {
        std::cin >> a[i] >> temp >> b[i];
    }

    std::vector<int> result(n);
    for(int i = 0; i < w; ++i)
    {
        result[i] = i + 1;
    }

    for(int i = 0; i < n; ++i)
    {
        std::swap(result[a[i] - 1], result[b[i] - 1]);
    }

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

    return 0;
}

C++: #include <stdio.h>

int main(void){
	int w=0, n=0;
	int a=0, b=0, t=0;
	int c[30];

	scanf("%d", &w);
	scanf("%d", &n);

	for(int i=0;i<w;++i){
		c[i] = i+1;
	}
	for(int i=0;i<n;++i){
		scanf("%d,%d", &a, &b);
		t = c[b-1];
		c[b-1] = c[a-1];
		c[a-1] = t;
	}
	for(int i=0; i<w;++i){
		printf("%d\n", c[i]);
	}
	return 0;
}

C++: #include<stdio.h>
int main(void){
	int w,n,x,y,temp;
	int a[31];
	char str[7];
	for(int i = 0; i < 31; i++){
		a[i] = i;
	}
	scanf("%d %d",&w,&n);
	for(int i = 0; i < n; i++){
		gets(str);
		if(str[3] == ',')
			str[3] = ' ';
		else
			str[2] = ' ';
		sscanf(str,"%d %d",&x,&y);
		temp = a[x];
		a[x] = a[y];
		a[y] = temp;
	}

	for(int i = 0; i < w; i++){
		printf("%d\n",&a[i + 1]);
	}
	return 0;
}

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

int w, n;
std::vector<int> ans;

int main() {
    int i = 0;

    std::cin >> w;
    std::cin >> n;

    ans.resize(w);
    for(i = 0; i < w; ++i) {
        ans[i] = i;
    }
    for(i = 0; i < n; ++i) {
        int a, b;
        char c;
        
        std::cin >> a >> c >> b;
        --a, --b;
        std::swap(ans[a], ans[b]);
    }
    for(int x: ans) {
        std::cout << x + 1 << std::endl;
    }
}