Go: package main

import "fmt"

func main() {
	var w, n, a, b, i, te int
	var amida [31]int
	fmt.Scanf("%d", &w)
	fmt.Scanf("%d", &n)
	for i := 1; i <= w; i++ {
		amida[i] = i
	}
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d,%d", &a, &b)
		te = amida[a]
		amida[a] = amida[b]
		amida[b] = te
	}
	for i := i; i <= w; i++ {
		fmt.Printf("%d\n", amida[i])
	}
}

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

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

C++: #include <cstdio>

void swap(int array[], int a, int b){
	int c = array[a];
	array[a] = array[b];
	array[b] = c;
}

int main(){
	int array[50];
	int w,n,a,b;

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

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

using namespace std;

int main(){
    int w, n, a, b;
    vector<pair<int, int>> h_lines;
    cin >> w >> n;
    vector<int> res(w+1);
    while(scanf("%d,%d",&a,&b)+1){
     h_lines.push_back(pair<int, int>(a,b));   
    }
    
    
    for (int i = 1; i <= w; ++i){
        int where = i;
        for (auto line:h_lines){
            if (line.first == where){
                where = line.second;
            } else if (line.second == where){
                where = line.first;
            }
        }
        res[where] = i;
    }
    
    for (auto itr = res.begin()+1; itr != res.end(); ++itr){cout << *itr << "\n";}
    
 return 0;   
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
#define int long long

signed main(){
        //int a;
        //while( scanf("%lld", &a) != EOF ){}

        int w;
        scanf("%lld",&w);
        vector<int> line(w);
        for(int i=0;i<w;i++){
                line[i] = i;
        }

        int n;
        scanf("%lld",&n);
        for(int i=0;i<n;i++){
        int a,b;
        scanf("%lld,%lld",&a,&b);
        int t = line[a-1];
        line[a-1] = line[b-1];
        line[b-1] = t;
        }

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


        return 0;
}

C++: #include<stdio.h>

int main(){
        int W,N;
        int w[30];

        scanf("%d",&W);
        scanf("%d",&N);

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

        int a,b,dm;
        for(int i=0;i<N;i++){
                scanf("%d,%d",&a,&b);

                //swap(w[a-1],w[b-1]
                dm = w[a-1];
                w[a-1]=w[b-1];
                w[b-1]=dm;
        }

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

        return 0;
}

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

int main()
{
	int n,i;
	cin>>n;
	int*p;
	p=new int[n];  
	for(i=0;i<n;i++)
    *(p+i)=i+1;
    
    int x,y,temp,k;
    cin>>k;
    for(i=0;i<k;i++)
    {	
    	scanf("%d,%d",&x,&y	);
    	temp=*(p+x-1);
    	*(p+x-1)=*(p+y-1);
    	*(p+y-1)=temp;
    }
    for(i=0;i<n;i++)
    	cout<<*(p+i)<<endl;
    
	delete []p;
	return 0;
}

C++: //--------------------------------------------------template----------------------------------------//
//c
#include <stdio.h>
#include <time.h>
#include <math.h>
//c++
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <complex>
#include <cmath>
//c++11
#include <tuple>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
//#define sort(v,n) sort(v,v+n)
//#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.rbegin(),v.rend())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int w, n;

int a[31], b[31];

int main() {
	cin >> w >> n;
	map<int, int> m;
	for (int i = 0; i < w; i++) {
		m[i + 1] = i + 1;
	}
	for (int i = 0; i < n; i++) {
		int c, d;
		scanf("%d,%d", &c, &d);
		int temp = m[c];
		m[c] = m[d];
		m[d] = temp;
	}
	for (int i = 1; i <= w; i++) {
		cout << m[i] << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>


using namespace std;

int main() {
    size_t w;
    scanf("%zu", &w);
    vector<size_t> dlots(w);
    iota(dlots.begin(), dlots.end(), 1);

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

    for (size_t i=0; i<w; ++i)
        printf("%zu\n", dlots[i]);

    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,d,i,z,x[1000];
	char w[10];
	scanf("%d %d",&a,&b);
	for(i=0;i<a;i++){
		x[i]=0;
		x[i]=i+1;
	}
	z=0;
	for(i=0;i<b;i++){
		scanf("%d %c %d",&c,w,&d);
		z=x[c-1];
		x[c-1]=x[d-1];
		x[d-1]=z;
	}
	for(i=0;i<a;i++){
		printf("%d\n",x[i]);
	}
	return 0;
}

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

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

	temp = *x;

	*x = *y;

	*y = temp;
}

int main()
{
	int w=0, n=0;

	std::cin >> w >> n;

	std::vector<int> order;

	for(int i=0; i<=w; ++i)
	{
		order.push_back(i);//1〜wまで添え字を使用
	}

	int a=0,b=0;

	char c;

	for(int i=0; i<n; ++i)
	{
		std::cin >> a >> c >> b; 

		swap(&order[a], &order[b]);
	}

	for(int i=1; i<=w; ++i)
	{
		std::cout << order[i] << '\n';
	}

}

C++: #define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif

int main(){
    int n,w;
    cin >> w >> n;
    int a[100];
    rep(i,w) a[i] = i+1;
    rep(i,n){
        int x,y;
        char c;
        cin >> x >> c >> y;
        swap(a[x-1],a[y-1]);
    }
    rep(i,w) cout << a[i] << endl;
}