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++: #include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int w,n;
	cin >> w >> n;
	vector<pair<int,int>> v;
	rep(i,0,n){
		int a,b;
		scanf("%d,%d",&a,&b);
		a--;
		b--;
		v.push_back(pair<int,int> (a,b));
	}
	
	int ans[w];

	rep(i,0,w){
		int now = i;
	
		rep(j,0,n){
			//cout << now << " " << v[j].first << " " << v[j].second << endl;
			if( v[j].first == now )
				now = v[j].second;
			else if( v[j].second == now)
				now = v[j].first;
		}
		
		ans[now] = i+1;
		
		//cout << "now:" <<  now+1 << endl;
	}
	
	rep(i,0,w)
		cout << ans[i] << endl;

	ret 0;
}

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

int main(int argc, const char * argv[])
{
    int w, n;
    
    cin >> w;
    cin >> n;
    
    int ary[w];
    for (int i=1; i<=w; i++) {
        ary[i-1] = i;
    }
    
    for (int i=0; i<n; i++) {
        int a, b;
        scanf("%d,%d",&a, &b);
        swap(ary[a-1], ary[b-1]);
    }

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

    return 0;
}

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

inline void swap(int& a, int&b)
{
    int tmp;
    tmp = a;
    a = b;
    b = tmp;
}

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

    int lots[w];
    for(int i=0; i<w; i++) lots[i] = i+1;
    
    cin >> n;
    for(int i=0; i<n; i++){
        int a, b;
        scanf("%d,%d", &a, &b);
        swap(lots[a-1], lots[b-1]);
    }

    for(int i=0; i<w; i++) cout << lots[i] << endl;

    return 0;
}

C++: #include<stdio.h>

int main(){
	int tate,yoko,bou[40][2],j,x,kekka[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30},i=0;
	scanf("%d %d",&tate,&yoko);
	for(j=0;j<yoko;j++){
		scanf("%d",&bou[j][1]);
		printf(",");
		scanf("%d",&bou[j][2]);
	}
	for(i=1;i<tate+1;i++){
		x=i;
		for(j=0;j<yoko;j++){
			if(bou[j][1]==x){
				x=bou[j][2];
			}
			else if(bou[j][2]==x){
				x=bou[j][1];
			}
		}
		kekka[x-1]=i;
	}
	for(j=0;j<tate;j++){
		printf("%d\n",kekka[j]);
	}
return 0;
}

C++: #include <stdio.h>
int main(){
    int n,m,x,y,a[31];
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)a[i]=i;
    for(int i=0;i<m;i++){
        scanf("%d,%d",&x,&y);
        a[0]=a[x];
        a[x]=a[y];
        a[y]=a[0];
    }
    for(int i=1;i<=n;i++){
        printf("%d\n",a[i]);
    }
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++) 
int w, n; 
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> w >> n;
	ll a[32];
	roop(i, 32) {
		a[i] = i + 1;
	}
	roop(i, n) {
		string s;
		cin >> s;
		string d[2];
		roop(i, s.length) {
			if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
		}
		int swap[2];
		roop(i, 2) {
			swap[i] = stoi(d[i]);
		}
		int before = a[swap[0] - 1];
		a[swap[0] - 1] = a[swap[1] - 1];
		a[swap[1] - 1] = before;
	}
	roop(i, n) {
		cout << a[i] << endl;
	}
	return 0;
}

C++: #include <algorithm>

#include <stdio.h>

int main(int argc, char** argv)
{
  int w, n;

  fscanf(stdin, "%d", &w);
  
  int ind[30] = { 1,  2,  3,  4,  5,  6,  7,  8,  9, 10,
		 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
		 21, 22, 23, 24, 25, 26, 27, 28, 29, 30
  };

  fscanf(stdin, "%d", &n);
  
  for (int i = 0; i < n; i ++) {
    int a, b;

    fscanf(stdin, "%d,%d", &a, &b);
    
    std::swap(ind[a - 1], ind[b - 1]);
  }
  
  for (int i = 0; i < w; i ++)
    fprintf(stdout, "%d\n", ind[i]);
}

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

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

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

int main(){
    int line[40]={};
    int linenum;
    int change;
    cin>>linenum>>change;
    for(int i=1; i<linenum+1; i++){
        line[i]=i;
    }
    int sw,ap;
    char waste;
    for(int i=0; i<change; i++){
        cin>>sw>>waste>>ap;
        swap(line[sw],line[ap]);
    }
    for(int i=1; i<linenum+1; i++){
        cout<<line[i]<<endl;
    }
    return 0;
}

C++: #include<stdio.h>

int main(void)
{
	int w,n,a,b,i,t,h[50];
	
	scanf("%d\n%d",&w,&n);

	for(i=1;i<=w;i++)
		h[i]=i;

	i=0;

	while(i<n)
	{
		scanf("%d,%d",&a,&b);
		t=h[a];
		h[a]=h[b];
		h[b]=t;
		i+=1;
	}
	for(i=1;i<=w;i++)
	{
	  printf("%d\n",h[i]);
	}

 return 0;
}

C++: #include <stdio.h>

void swap(int* a,int* b);

int main(void) {

  int w,n;
  int seq[50];
  int a,b;
  int i;
  
  scanf("%d",&w);

  for(i=0;i<w;i++) seq[i]=i+1;

  scanf("%d",&n);

  for(i=0;i<n;i++) {
    scanf("%d,%d",&a,&b);
    swap(seq+a-1,seq+b-1);
    }

  for(i=0;i<5;i++) printf("%d\n",seq[i]);
 
  return 0;
}

void swap(int* a,int* b) {
  int temp;

  temp=*a;
  *a=*b;
  *b=temp;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <bitset>
#include <queue>
#include <map>
#include <string>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<long long int,long long int> 
#define ff first
#define pb push_back
#define ss second
#define ll long long 
#define ull unsigned long long
#define vi vector<long long int>
#define vii vector<pii>
#define vvi vector <vi>
#define rep(x,a,b,c) for(int x=a;x<=b;x+=c)
#define repp(x,a,b) rep(x,a,b,1)
#define rev(x,a,b,c) for(int x=a;x>=b;x-=c)
#define revv(x,a,b) rev(x,a,b,1)
#define OO (int)2e9
#define INF (ll)1e18
 
using namespace std;

int n,list[50],a,b,k;

int main()
{
	scanf("%d",&n);
	repp(x,1,n)
	{
		list[x]=x;
	}
	scanf("%d",&k);
	repp(x,1,k)
	{
		scanf("%d,%d",&a,&b);
		swap(list[a],list[b]);
	}
	repp(x,1,n)
	{
		printf("%d\n",list[x]);
	}
	return 0;
}