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++: #include <iostream>
#include <cmath>

using namespace std;
void lots(int len,int a,int b,int array[]){
    int buffer[5];
    for(int i = 0;i < len; i++){
        if(i == a-1){
            buffer[i] = array[b-1];
        }
        else if(i == b-1){
            buffer[i] = array[a-1];
        }
        else{
            buffer[i] = array[i];
        }
    }
    for(int i = 0; i < len; i++){
        array[i] = buffer[i];
    }

}

int main(){
    int len,duration,a,b;
    cin >> len;
    cin >> duration;
    int array[] = {1,2,3,4,5};
    for(int i = 0; i < duration; i++){
        scanf("%d,%d",&a,&b);
        lots(len,a,b,array);
    }
    for(int i = 0; i < len; i++){
        cout << array[i] << endl;
    }
}

C++: /*****include*****/
#include <iostream>
#include <fstream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/
void Exchange(int *a,int *b){
	int w;
	w = *a;
	*a = *b;
	*b = w;
}
/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	int *goal;
	int w;
	int n;
	int a,b;
	cin >> w >> n;
	goal = new int [w+1];
	for(int i=1;i<=w;i++){
		goal[i] = i;
		//cout << goal[i] << " ";
	}
	//cout << endl;
	for(int i=0;i<n;i++){
		scanf("%d,%d",&a,&b);
		Exchange(&goal[a],&goal[b]);
		//cout << goal[a] << " " << goal[b] << endl;
	}
	for(int i=1;i<=w;i++){
		cout << goal[i] << endl;
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

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

typedef struct{
	int x;
	int y;
}t_swap;

int main(){
	int m, n;
	char c;

	cin >> m;
	cin >> n;
	int* w = new int[ m + 1 ];
	t_swap* swap = new t_swap[ n ];

	for ( int i = 0; i < n; ++i ){
		cin >> swap[ i ].x >> c >> swap[ i ].y;
	}

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

	for ( int i = 0; i < n; ++i ){
		int t = w[ swap[ i ].x ];
		w[ swap[ i ].x ] = w[ swap[ i ].y ];
		w[ swap[ i ].y ] = t;
	}

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


	delete[] swap;
	delete[] w;

	return 0;
}

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

#define WMAX 30
#define NMAX 30

int v_pos[WMAX]; // ??????????????????????????????????????¶???

void exchange(int v_pos[], int a, int b){
	swap(v_pos[a], v_pos[b]);
}

int main(){
	int w, n;
	int a, b;
	char input[6], *token1, *token2;
	cin >> w >> n;
	for(int i=1;i<=w;i++){
		v_pos[i] = i;
	}

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

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

void swap(int* x, int* y) {
	int temp = *x;
	*x = *y;
	*y = temp;
}

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

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

	int ops;
	cin >> ops;

	while (ops--) {
		int x, y;
		scanf("%d,%d", &x, &y);

		swap(a[x], a[y]);
	}

	for (int i = 1; i <= w; i++) 
		cout << a[i] << endl;

	return 0;
}

C++: #include <iostream>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main(){
	int widthCount = 0, heightCount = 0;
	string tmp;

	cin >> widthCount >> heightCount;

	vector<int> width(widthCount);
	for(int i = 0; i < widthCount; i++){
		width[i] = i + 1;
	}
	
	pair<int,int> height;
	/*height.first = vector<int>(heightCount,0);
	height.second = vector<int>(heightCount,0);*/

	char *a = new char[4];
	char *tp;

	for(int i = 0; i < heightCount; i++){
		cin >> tmp;
		
		strcpy(a,tmp.c_str());
		
		tp = strtok(a,",");
		height.first = atoi(tp);
		tp = strtok(NULL,",");
		height.second = atoi(tp);

		swap(width[height.first - 1],width[height.second - 1]);

	}

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

	return 0;
}

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

int main()
{
	int w,n;
	cin >> w >> n;
	vector<int> line;
	for(int i=0; i<w; ++i)
	{
		line.push_back(i);
	}

	for(int i=0; i<n; ++i)
	{
		string str;
		cin >> str;
		int dot = str.find(',');
		string numa = str.substr( 0, dot );
		string numb = str.substr( dot+1, str.size()-1 );
		int A,B;
		istrstream( numa.data() ) >> A;
		istrstream( numb.data() ) >> B;
		--A;
		--B;
		int x = line[A];
		line[A] = line[B];
		line[B] = x;
	}

	for(int i=0; i<w; ++i)
	{
		cout << line[i]+1 << '\n';
	}
}

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

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const double INF = 1e12;



int num[31];
int main(){
	int w,n;
	while(cin>>w){
		cin>>n;
		REP(i,w+1)num[i]=i;
		REP(i,n){
			int a,b;char c;
			cin>>a>>c>>b;
			swap(num[a],num[b]);
		}
		REP(i,w)cout<<num[i+1]<<endl;
	}
	return 0;
}