Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	lines, _ := strconv.Atoi(sc.Text())
	l := make([]int, lines)
	for i := 0; i < lines; i++ {
		l[i] = i + 1
	}

	sc.Scan()
	rows, _ := strconv.Atoi(sc.Text())
	for i := 0; i < rows; i++ {
		sc.Scan()
		s := strings.Split(sc.Text(), ",")
		a, _ := strconv.Atoi(s[0])
		b, _ := strconv.Atoi(s[1])

		l[a-1], l[b-1] = l[b-1], l[a-1]
	}
	for _, j := range l {
		fmt.Println(j)
	}
}

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;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

void out1(vector<int> a) {
	for (size_t i = 0; i < a.size(); i++)
	{
		cout << a[i] << " ";
	}
	cout << endl;
}

int main() {
	int w, n;
	cin >> w;	// ???????????°
	cin >> n;	// ?¨?????????°
	vector<int> begin(n);
	vector<int> end(n);
	vector<int> location(w);
	int num1 = 0;
	int num2 = 0;

	// ??\???
	for (size_t i = 0; i < n; i++)
	{
		scanf_s("%d,%d", &begin[i], &end[i]);
		cout << begin[i] << end[i] << endl;
	}

	// location????????????
	for (size_t i = 0; i < w; i++)
	{
		location[i] = i + 1;
		
	}
	
	// ????????\??¬????????§????????????
	for (size_t i = 0; i < w; i++)
	{
		vector<int> tmp(w,0);
		out1(tmp);
		tmp[i] = location[i];
		cout << "----i = " << i << "?????¨???----" << endl;
		for (size_t j = 0; j < n; j++)
		{
			if (begin[j] == location[i])
			{
				
				cout << begin[j] << "???" << end[j] << "?????\???????????????" << endl;
				location[i] = end[j];
			}
			else if (end[j] == location[i])
			{
				cout << end[j] << "???" << begin[j] << "?????\???????????????" << endl;
				location[i] = begin[j];
			}
			out1(location);
		}
	}
	// ???????????????
	vector<int> output(w,0);
	for (size_t i = 0; i < w; i++)
	{
		output[location[i]-1] = i;
	}

	// ???????????¨???????????????????????°??????1????¶????
	for (size_t i = 0; i < w; i++)
	{
		cout << output[i]+1 << endl;
	}


	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
std::vector<int> change (std::vector<int> v,int i, int j) {
	int tmp = v[i-1];
	v[i-1] = v[j-1];
	v[j-1] = tmp;
	return v;
}
int main () {
	int w,n;
	cin >> w >> n;
	std::vector<int> num(w);
	for(int i = 0; i < w; i++){
		num[i] = i+1;
	}
	for(int i = 0; i < n; i++){
		int a,b;
		scanf("%d,%d",&a,&b);
		num = change(num,a,b);
	}
	for(int i = 0; i < w; i++) {
		cout << num[i]<< endl;
	}
}