Go: package main

import "fmt"

func main() {
	var w, n int
	fmt.Scan(&w)
	numbers := make([]int, w)

	fmt.Scan(&n)

	intersect := make([][2]int, n)

	for i := 0; i < n; i++ {
		var x, y int
		fmt.Scanf("%d,%d", &x, &y)
		intersect[i] = [2]int{x, y}
	}

	for i := 0; i < w; i++ {
		numbers[i] = i + 1
	}

	for _, v := range intersect {
		swap(numbers, v[0], v[1])
	}

	for _, v := range numbers {
		fmt.Println(v)
	}
}

func swap(arr []int, x, y int) {
	tmp := arr[x-1]
	arr[x-1] = arr[y-1]
	arr[y-1] = tmp
}

C++: /*
NOTE :
*min_element(.begin(),.end())
*max_element(.begin(),.end())
priority_queue<> pq
 push()  pop() size()  top()
map<>
 find() begin() end() insert(map<>::value_type())
pair<>
sort(.begin(), .end())
sort(arr, arr+N)
sort(a, a+N, greater<int>())
binary_search(vc.begin(), vc.end(), x)  //binary_search???true, false?????????
vector<int>::iterator lit = lower_bound(vc.begin(), vc.end(), x);
  lower_bound?????????????????????"??\???"????????????????????????????????????????????¬???????????????
vector<int>::iterator uit = upper_bound(vc.begin(), vc.end(), x);
  upper_bound????????????????????????"?¶???????"?????????????????????????????????????????¬???????????????
*/
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <valarray>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>

#define MAX 100
#define INF 1<<20
#define LLINF 10e12 // 1<<31 // 2^31
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,a,n) for(int i=(a);i<(n);i++)
#define SET(a,c) memset(a,c,sizeof a)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique(ALL((o))), (o).end());

using namespace std;
typedef long long ll;
typedef valarray<int> array_t;
/////

/////
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // FROM HERE
  int w; scanf("%d",&w);
  int n; scanf("%d",&n);
  vector<int> T(w);
  REP(i,w) T[i] = i;
  REP(i,n)
  {
    int a, b;
    scanf("%d,%d",&a,&b);
    swap(T[a-1],T[b-1]);
  }
  REP(i,w) cout << T[i]+1 << endl;
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int ans[30];
int main() {
	int w, n; cin >> w >> n;
	vector<P>vec;
	rep(i, n) {
		int a, b; scanf("%d,%d", &a, &b);
		vec.push_back(P(a, b));
	}
	for (int i = 1; i <= w; i++) {
		int pos = i;
		rep(j, vec.size()) {
			if (vec[j].first == pos)pos = vec[j].second;
			else if (vec[j].second == pos)pos = vec[j].first;
		}
		ans[--pos] = i;
	}
	rep(i, w) {
		cout << ans[i] << endl;
	}
	return 0;
}

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

int main(){
	int n,w,ans[31],from,to;
	char com;
	cin>>w>>n;
	for(int i=1;i<=w;i++){
		ans[i]=i;
	}
	for(int i=0;i<n;i++){
		cin>>from>>com>>to;
		int tmp=ans[from];
		ans[from]=ans[to];
		ans[to]=tmp;
	}
	for(int i=1;i<=w;i++){
		cout<<ans[i]<<endl;
	}
    return 0;
}

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

using namespace std;

int main() {
  int W;
  int N;
  int num[30];

  
  cin >> W;
  cin >> N;
  for (int i = 0; i < W; i++) {
    num[i] = i+1;
  }
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a;
    cin.ignore();
    cin >> b;
    swap(num[a-1], num[b-1]);
  }
  for (int i = 0; i < W; i++) {
    cout << num[i] << endl;
  }
  return 0;
}

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

int main(void){
    int w,n;
    std::cin>>w;
    std::vector<int> state(w+1);
    for(int i=1;i<=w;i++) state[i]=i;
    std::cin>>n;
    int a,b;
    for(int i=0;i<n;i++){
        scanf("%d,%d",&a,&b);
        std::swap(state[a[i]],state[b[i]]);
    }
    for(int i=1;i<=w;i++) std::cout<<w[i]<<std::endl;
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

	int a,b,c;
	int Buffer;
	int VirticalLine[30];
	int HorizonLine[30][2];
	char BB;
			
	
	
	cin>>a>>b;
	
	for(c=0;c<a;c++){
	VirticalLine[c] = c+1;
	}
	for(c=0;c<b;c++){
	cin>>HorizonLine[c][0]>>BB>>HorizonLine[c][1];
	}
	for(c=0;c<b;c++){

		Buffer = VirticalLine[HorizonLine[c][1]-1];
		VirticalLine[HorizonLine[c][1]-1] = VirticalLine[HorizonLine[c][0]-1];
		VirticalLine[HorizonLine[c][0]-1] = Buffer;

	}

	for(c=0;c<a;c++)
	{
	cout<<VirticalLine[c]<<endl;
	}

return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i = 0; i < (n);++i)
#define repc(i,a,b) for(int i = (a);i <(b);++i)
#define repa(n,array) for(auto n :(array))

typedef long long ll ;
typedef vector<int> vi ;
typedef vector<ll> vl ;

constexpr int IMAX = ((1<<30)-1)*2+1 ;
constexpr int INF = 100000000;
double EPS = 1e-10 ;

int main(){
  char c;
  int w,n,a,b,num,ans[5];
  bool flag = true;
  cin >> w >> n;
  vi v(w,0),va,vb ;
  rep(i,n){
    cin >> a >> c >> b ;
    va.pb(a),vb.pb(b) ;
  }

  rep(i,w){
    num = i+1 ;
    rep(j,n){
      if(num == va[j]){
        num = vb[j];
      }
      else if(num == vb[j]){
        num = va[j];
      }
    }
    ans[num-1] = i+1;
  }
  repa(tmp,ans){
    cout << tmp << endl;
  }
  return 0;
}

C++: #include<stdio.h>
 
int main(){
    int t[30];
    for(int i=0;i<30;i++)t[i]=i+1;
    int a,b;
    scanf("%d%d",&a,&b);
    for(int i=0;i<b;i++){
        int c,d;
        scanf("%d,%d",&c,&d);
        int s=t[c-1];
        t[c-1]=t[d-1];
        t[d-1]=s;
    }
    for(int i=0;i<a;i++)printf("%d\n",t[i]);
}

C++: #include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <stdlib.h>

using namespace std;

int main (void)
{
	int n,m,a[31],b[31];

	cin >> n >> m;

	char o;

	for (int i = 0; i < m; i++)
	{
		cin >> a[i] >> o >> b[i];
	}

	int p[31];

	for (int j = 1; j < n + 1; j++)
	{
		p[j] = j;
	}

	for (int i = 0; i < m; i++)
	{
		int ha = 0,hb = 0;

		ha = p[b[i]];
		hb = p[a[i]];

		p[a[i]] = 0;
		p[a[i]] = ha;

		p[b[i]] = 0;
		p[b[i]] = hb;
	}

	for (int j = 1; j < n + 1; j++)
	{
		cout << p[j] << endl;
	}
}

C++: #include<iostream>

using namespace std;
 
int main() {
	
    int L[30];
    for(int i=0;i<30;i++)
	L[i]= i + 1;
	
    int a,b;
    cin >> a >> b;
    for(int i=0;i<b;i++){
    	
        int c,d;
        cin >> c >> d;
        
        int s = L[c-1];
        L[c-1] = L[d-1];
        L[d-1] = s;
        
    }
    for(int i=0;i<a;i++)
	cout << L[i] << "\n";
	return 0;
}

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

int main() {
	int w, n;
	string str;
	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;
		string str;
		cin >> str;
		a = str[0] - '0';
		b = str[2] - '0';
		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 <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#define INF 1000000000
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define all(x) (x).begin(),x.end()
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

int main(){
  int w,n;
  int array[35];
  cin>>w>>n;
  REP(i,1,w+1)array[i]=i;
  rep(i,n){
    int a,b;
    cin>>a;
    getchar();
    cin>>b;
    swap(array[a],array[b]);
  }
  for(int i=1;i<=w;i++){
    cout<<array[i]<<endl;
  }
  return 0;
}