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 <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl


long res[30];
long from[30],to[30];

int main(){
	li w,n;
	cin>>w>>n;
	
	rep(i,w)res[i]=i;
	
	rin{
		scanf("%ld,%ld", &from[i], &to[i]);
	}
	
	rin{
		swap(res[from[i]-1],res[to[i]-1]);
	}
	
	rep(i,w)cout<<res[i]+1<<endl;
	
	return 0;
}

C++: #include <stdio.h>

void swap(int array[], int a, int b){
	int c;
	c = array[a];
	array[a] = array[b];
	array[b] = c;
}

int main(){
	int array[50];
	int w,n,a,b;

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

C++: #include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int w,n;
    int W[30],a,b;
    
cin>>w>>n;
    for(int i=1;i<=30;i++){
       W[i]=i;
    }
       for(int i=1;i<=n;i++){
        (cin>>a).ignore()>>b;
swap(W[a],W[b]);
    } 
        for(int i=1;i<=w;i++){
    cout<<W[i]<<endl;
        }
}

C++: //suhan lee, saitama university;
#include <stdio.h>


int main(){
  int list[30];
  int n,i,w,a,b,j,tmp,tmpp;
  scanf("%d%d", &w, &n);
  for(i=1;i<w+1;i++)
    list[i]=i;
  for(i=0;i<n;i++){
    scanf("%d%c%d", &a, &tmpp, &b);
    tmp=list[a];
    list[a]=list[b];
    list[b]=tmp;
 
  }
 for(j=1;j<w+1;j++)
    printf("%d\n",list[j]);
  
 return 0;
}

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

void swap( int &a, int &b )
{
 	int t;
	t = a;
	a = b;
	b = t;
	
	return;
}

int main()
{
	int w, n;
	int ans[30];
	std::vector<std::pair<int,int> > vec;
	
	scanf( "%d", &w );
	scanf( "%d", &n );
	for( int i = 0; i < n; i++ ){
		int a, b;
		scanf( "%d,%d", &a, &b );
		vec.push_back( std::make_pair<int,int>( a, b ) );
	}
	
	for( int i = 0; i < w; i++ ) ans[i] = i + 1;
	
	for( std::vector<std::pair<int,int> >::iterator it = vec.begin(); it != vec.end(); it++ ){
		swap( ans[ it->first - 1 ], ans[ it->second - 1 ] );	
	}
	
	for( int i = 0; i < w; i++ ){
	 	std::cout << ans[i] << std::endl;
	}

 	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>

using namespace std;

int main() {
	int w, n;
	int change[30][2];
	int line[30];
	cin >> w >> n;
	for (int i = 0; i < n; ++i) {
		scanf("%d,%d", &change[i][0], &change[i][1]);
	}
	
	for (int i = 0; i < w; ++i) {
		line[i] = i + 1;
	}
	for (int i = 0; i < n; ++i) {
		swap(line[change[i][0] - 1], line[change[i][1] - 1]);
		//for (int i = 0; i < w; ++i) {
		//	cout << line[i] << " ";
		//}
		//cout << endl;
		//cout << "--------------------------" << endl;
	}
	for (int i = 0; i < w; ++i) {
		cout << line[i] << endl;;
	}
}

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

int main()
{
  int w, n;
  cin >> w >> n;
  vector<int> amd(w);

  for (unsigned int i = 0; i < amd.size(); ++i)
    amd[i] = i+1;

  for (int i = 0; i < n; ++i) {
    string line;
    cin >> line;
    int a = atoi(line.substr(0, line.find_first_of(",", 0)).c_str());
    int b = atoi(line.substr(line.find_first_of(",", 0)+1).c_str());
    swap(amd[a-1], amd[b-1]);
  }
  for (unsigned int i = 0; i < amd.size(); ++i)
    cout << amd[i] << endl;

  return 0;
}

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

using namespace std;

int main(void) {
	int w, n, a[31], b[31], ans[31];
	
	cin >> w >> n;
	for (int i = 1; i <= n; i++) {
		scanf("%d,%d", &a[i], &b[i]);
	}
	for (int i = 1; i <= w; i++) {
		int point = i;
		for (int j = 1; j <= n; j++) {
			if (point == a[j]) {
				point = b[j];
			}
			else if (point == b[j]) {
				point = a[j];
			}
		}
		ans[point] = i;
	}
	for (int i = 1; i <= w; i++) {
		cout << ans[i] << endl;
	}
}

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

int main() {
	int w; cin >> w; int n; cin >> n;
	vector<int> vec; vec.resize(w);	int a, b; char op;
	for (int i = 0; i < w; i++) vec[i] = i + 1;
	for (int i = 0; i < n; i++) {
		cin >> a >> op >> b; swap(vec[a - 1], vec[b - 1]);
	}
	for (int i = 0; i < w; i++) cout << vec[i] << endl;
	return 0;
}

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

int main()
{
    int w,n;
    cin >> w;
    cin >> n;
    int order[30]={0};
    int a,b,temp;
    for (int i=0; i<w; i++)
    {
	order[i]=i;
    }
    for (int i=0; i<n; i++)
    {
	scanf("%d,%d",&a,&b);
	temp=order[a-1];
	order[a-1]=order[b-1];
	order[b-1]=temp;
    }
    for (int i=0; i<w; i++)
    {
	cout << order[i]+1 << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int main() {
	int w, n;
	int a[30][2];
	int ans[30];

	int i;

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

	for(i = 0; i < n; i++)
		scanf("%d,%d", &a[i][0], &a[i][1]);

	for(i = 0; i < w; i++)
		ans[i] = i + 1;
	
	for(i = 0; i < n; i++) {
		int temp;

		temp = ans[a[i][0] - 1];
		ans[a[i][0] - 1] = ans[a[i][1] - 1];
		ans[a[i][1] - 1] = temp;
	}

	for(i = 0; i < w; i++)
		printf("%d\n", ans[i]);

	return 0;
}

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

using namespace std;

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

    vector<int> v(w);
    iota(v.begin(), v.end(), 1);

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

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

    return 0;
}

C++: 


#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
	int n, m;
	int ver[31];
	scanf("%d", &n);
	scanf("%d", &m);
	for (int i = 0; i < n; i++) {
		ver[i] = i + 1;
	}
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d,%d", &x, &y);
		swap(ver[x-1], ver[y-1]);
	}
	for (int i = 0; i < n; i++) {
		printf("%d\n", ver[i]);
	}
	return 0;
}