Go: package main

import (
        "fmt"
)

const MAX_N = 31
var lines [MAX_N]int

func main() {
        var n, w int
        fmt.Scanf("%d", &n)
        fmt.Scanf("%d", &w)

        Init()
        var l, r int
        for {
                _, err := fmt.Scanf("%d,%d", &l, &r)
                if err != nil {
                        break
                }

                Swp(l, r)
        }

        for i := 1; i <= n; i++ {
                fmt.Printf("%d\n", lines[i])
        }
}

func Swp(l int, r int) {
        var s int
        s = lines[l]
        lines[l] = lines[r]
        lines[r] = s
}

func Init() {
        for i := 0; i < MAX_N; i++ {
                lines[i] = i
        }
}

C++: #include <iostream>                                           
#include <vector>                                             
using namespace std;                                          
                                                              
int main() {                                                  
  int w, n;                                                   
  cin >> w >> n;                                              
  int a, b;                                                   
  char com;                                                   
  vector<int> r;                                              
  for (int i=0; i<=w; i++) {                                  
    r.push_back(i);                                           
  }                                                           
  for (int i=0; i<n; i++) {                                   
    cin >> a >> com >> b;                                     
    swap(r[a],r[b]);                                          
  }                                                           
  for (int i=1; i<=w; i++) {                                  
    cout << r[i] << endl;                                     
  }                                                           
  return 0;                                                   
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
using namespace std;

int main() {
	int w, n;
	cin >> w >> n;
	int ami[30];
	for (int i = 0; i < w; i++) {
		ami[i] = i + 1;
	}
	for (int i = 0; i < n; i++) {
		int a, b, temp;
		cin >> a >> b;
		temp = ami[a-1];
		ami[a-1] = ami[b-1];
		ami[b-1] = temp;
	}
	for (int i = 0; i < w; i++) {
	cout << ami[i] <<endl;
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main() {
int w, n;
cin >> w >> n;
vector<int> vec;
for (int i = 0; i < w; ++i) {
  vec.push_back(i + 1);
}
for (int i = 0; i < n; ++i) {
  int a, b;
  scanf("%d,%d", a, b);
  a -= 1;
  b -= 1;
  int tmp = vec[a];
  vec[a] = vec[b];
  vec[b] = tmp;
}
for (int i = 0; i < vec.size(); ++i) {
  cout << vec[i] << endl;
}
return 0;
}

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

void Swap(int arr[], int x, int y){
    int temp;
    temp = arr[x];
    arr[x] = arr[y];
    arr[y] = temp;
}

int main(){

    int w, n;
    cin >> w >> n;
    vector<int> arr(w+1);

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

    for(int m=0; m<n; m++){
        int a, b;
        scanf("%d,%d", &a, &b);

        Swap(arr.data(), a, b);
    }

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


    return 0;
}

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

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

	cin >> w >> n;

	for(int i=0;i<w;++i)
		list.push_back(i);

	for(int i=0;i<n;++i){
		int a,b,tmp;
		char dummy;
		cin >> a >> dummy >> b;

		a--;
		b--;

		tmp		= list[a];
		list[a]	= list[b];
		list[b]	= tmp;

	}

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

	return 0;
}

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

using namespace std;

int main() {
    int w,n,amida[30],yoko1,yoko2,i;

    cin >> w >> n;

    for(i = 1;i <= w;i++){
        amida[i] = i;
    }

    for(i = 0;i < n;i++){
        scanf("%d,%d",&yoko1,&yoko2);
        int box = amida[yoko1];
        amida[yoko1] = amida[yoko2];
        amida[yoko2] = box;
    }

    for(i = 1;i <= w;i++){
        cout << amida[i] << endl;
    }
    
    return 0;
}

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

int main()
{
  int w,n;
  int c[]={0};
  int a,b;
  //  int temp;

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

  for(int i=0; i<=n; i++){
    c[i]=i;
  }

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

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

C++: #include <iostream>

using namespace std;


int main(int argc, char const* argv[])
{
	int w,n;
	int a[30],b[30];
	int answer[31];

	cin >> w;

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

	cin >> n;

	char comma;
	for( int j = 0;j < n;j++ ) cin >> a[j] >> comma >> b[j];

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

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


	return 0;
}

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

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

C++: #include <iostream>
#include <list>
using namespace std;
void swap(char *in,int a,int b)
{
    char tp;
    tp=in[a];
    in[a]=in[b];
    in[b]=tp;
}
int main()
{
    char *lost,a,b,p;
    int w,n,i;
    cin>>w;
    lost=new char[w];
    for (i=1;i<=w;i++)
        lost[i-1]=i+0x30;
    cin>>n;
    while(n--)
    {
        cin>>a>>p>>b;
        swap(lost,a-0x30-1,b-0x30-1);
    }
    for (i=0;i<w;i++)
    {
        cout<<lost[i]<<endl;
    }
    return 0;
}

C++: //-------------
//include
//-------------
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <vector>
#include <string>
#include <cctype>
#include <numeric>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
//-------------
//typedef
//-------------
typedef  long long LL;
typedef  vector<int> VI;
typedef  vector<string> VS;
typedef  pair<int, int> PII;
typedef  vector<int, int> VII;
typedef  map<string, int> MSI;
//-------------
//utillty
//-------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MK make_pair
#define PB push_back
#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(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//-------------
//debug
//-------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumpl(x) REP(i,SZ(x))cerr<<i<<x<<"="<<x[i]<<endl;
#define SIZE(x) cout<<sizeof(x)<<endl;
const int MOD = 1000000007;
//-------------
//cout
//-------------
#define COUTL(x) cout<<x<<endl
#define COUT(x) cout<<x
//-------------
//??£?¨??????\
//-------------
#define INTIN(x) int x; cin>>x;
#define INTINTIN(x,y) int x,y; cin>>x>>y;
#define STRIN(x) string x; cin>>x;
int main()
{
	VI amida;
	int w,n;
	cin >> w >> n;
	REP(i,w)
	{
		amida.push_back(i+1);
	}
	REP(i, n)
	{
		string temp;
		cin >> temp;
		int x = temp[0] - 48;
		int y = temp[2] - 48;
		int test;
		test = amida[x-1];
		amida[x - 1] = amida[y - 1];
		amida[y - 1] = test;
	}
	REP(i, w)
	{
		if (i == w-1)
		{
			COUT(amida[i]);
		}
		else
		{
			COUT(amida[i]);
		}
	}
	#ifdef _DEBUG
	while(1);
#endif
	return 0;
}