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 <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <set>
#include <cmath>

namespace CSV{
	class CistreamCsv { // http://homepage2.nifty.com/well/Stream.html CSV Stream
		// }js[^ endl Ìè`
		friend CistreamCsv& CSV::endl(CistreamCsv& riscsv);
	private:
		std::istream& m_ris;     // üÍÉg¤ istream ÌQÆ
	public:
		CistreamCsv(std::istream& ris) : m_ris(ris) {}
		CistreamCsv& operator >>(int& ri) {
			ri = 0;
			int iChar = 0;
			// óðÇÝòÎ·B
			while (isspace(iChar = m_ris.get()) && iChar != '\n') {}
			if (iChar == EOF ) { return *this; }
			std::string strValue;
			if (iChar == '\n') { m_ris.putback(iChar); iChar = 0; }
			else               { strValue += iChar;               }
			// R}ÜÅÇÞB
			while ((iChar = m_ris.get()) != ',' && iChar != EOF && iChar != '\n') {
				strValue += iChar;
			}
			ri = std::atoi(strValue.c_str());
			if (iChar == EOF ) { return *this;         }
			if (iChar == '\n') { m_ris.putback(iChar); }
			return *this;
		}
		// }js[^ðó¯üêé½ßÌ}üZq
		CistreamCsv& operator >>(CistreamCsv& (*pmanipulatorfunction)(CistreamCsv&)) {
			return (*pmanipulatorfunction)(*this);
		}
	};
	CistreamCsv& endl(CistreamCsv& riscsv) {
        int iChar = 0;
        while ((iChar = riscsv.m_ris.get()) != '\n' && iChar != EOF) {}        // sÜÅÇÝòÎ·B
        return riscsv;
    }
};
int main(int,char**){
	int w,n;
	std::cin >> w >> n;
	CSV::CistreamCsv CSVin(std::cin);
	CSVin>> CSV::endl;

	std::vector<int> dl;
	dl.reserve(w);
	for(int i(0);i<w;++i) dl.push_back(i);
	while(n--){
		int s1,s2;
		CSVin>> s1>>s2>>CSV::endl;
		//std::cout << s1<<s2<<std::endl;
		std::swap(dl[s1-1],dl[s2-1]);
	}
	for(int i(0);i<w;++i) std::cout << dl[i]+1<<std::endl;
	return 0;
}

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

using namespace std;

int main() {
	int i, j, l, num[31], w, n, a=0, b=0, c;
	char s[5], as[2], bs[2];
	
	cin >> w;
	for (i = 1; i <= w; i++) {
		num[i] = i;
	}
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> s;
		for (j = 0; s[j] != ','; j++) {
			as[j] = s[j];
		}
		for (l=j; s[j + 1] != NULL; j++) {
			bs[j - l] = s[j + 1];
		}
		a = atoi(as);
		b = atoi(bs);
		c = num[a];
		num[a] = num[b];
		num[b] = c;
	}
	for (i = 1; i <= w; i++) {
		cout << num[i] << endl;
	}
	return 0;
}

C++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#include <bits/stdc++.h>
using namespace std;

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

C++: #include<iostream>
void swap(int a,int b){
	int t=a;
	a=b;
	b=t;
	return ;
	}
int main(){
	int w;
	int n;
	int c[30];
	int a[30];
	int b[30];
	scanf("%d",&w);
	scanf("%d",&n);
	for(int i=0;i<w;i++){
		c[i]=i;
		}
	for(int i=0;i<n;i++){
		scanf("%d%d",&a[i],&b[i]);
        swap(c[a[i]],c[b[i]]);
       }
     for(int i=0;i<w;i++){
     	cout<<c[i]<<endl;
     }
     return 0;
    }

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

int main(){
	int w, n, a, b, temp;
	vector<int> array;
	cin >> w >> n;
	for(int i=1; i<=w; i++){
		array.push_back(i);
	}
	for(int i=0; i<n; i++){
		temp = 0;
		a = 0;
		b = 0;
		scanf("%d,%d",&a,&b);
		a--;
		b--;
		temp = array[a];
		array[a] = array[b];
		array[b] = temp;
	}
	for(int i=0; i<w; i++){
		cout << array[i] << endl;
	}
	return 0;
}

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

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

C++: #include <iostream>

using namespace std;

int main(){
	int w, n;
	cin >> w >> n;
	int s[w];

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

		while(n--){
		int a, b;
		cin >> a >> b;

		int tmp = s[a-1];
		s[a-1] = s[b-1];
		s[b-1] = tmp;
	}

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

C++: #include <bits/stdc++.h>

#define times(n, i) uptil(0, n, i)
#define upto(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i <= _##i poi  i++)
#define uptil(f, t, i) for(auto _##i = (t), i = decltype(_##i)(f) poi  i < _##i poi  i++)
#define downto(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i >= _##i poi  i--)
#define downtil(f, t, i) for(auto i = (f), _##i = decltype(i)(t) poi  i > _##i poi  i--)

#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define poi ;
#define poipoi << "\n"

using namespace std;

#define fuwafuwa(n, c) dokidoki((n) + (c) - 1, c)
#define dokidoki(n, c) ((n) / (c) * (c))

template<class T> bool read(T& t){
    return cin >> t poi
}
template<class T, class...U> bool read(T& t, U&... u){
    unless(cin >> t) return false poi
    return read(u...) poi
}

template<class T> T lov_yet(T t){
    if(t) return t poi
    else return 0 poi
}

template<class T> T gcd(T a, T b){
    if(b) return gcd(b, a % b) poi
    else return a poi
}

pair<double, double> solve_linear(double a1, double b1, double c1, double a2, double b2, double c2){
    return make_pair(lov_yet((b1 * c2 - b2 * c1) / (b1 * a2 - b2 * a1)), lov_yet((a1 * c2 - a2 * c1) / (a1 * b2 - b1 * a2))) poi
}

double distance(const pair<double, double>& p){
    return lov_yet(sqrt(p.first * p.first + p.second * p.second)) poi
}
double distance(const pair<double, double>& a, const pair<double, double>& b){
    return distance(make_pair(a.first - b.first, a.second - b.second)) poi
}

int main(){
    int W, N poi
    cin >> W >> N poi

    vector<int> pyon(W) poi
    times(W, i) pyon[i] = i poi

    times(N, i){
        int A, B poi
        char comma poi
        cin >> A >> comma >> B poi
        A--poi B--poi
        swap(pyon[A], pyon[B]) poi
    }

    times(W, i) cout << pyon[i] + 1 poipoi poi

    return 0 poi
}

C++: #include <iostream>
using namespace std;
int main(){
	int w,n,a[31],b[31],last[31];
	char f;
	cin>>w>>n;
	for(int i=1;i<n+1;i++){
		cin>>a[i]>>f>>b[i];
	}
	for(int i=1;i<w+1;i++){
		int l=i;
		//cout <<l<<endl;
		for(int j=1;j<n+2;j++){
			if(l==a[j]){
				l=b[j];
				//cout<<a[j]<<" "<<l<<endl;
			}
			else if(l==b[j]){
				l=a[j];
				//cout<<b[j]<<" "<<l<<endl;
			}
			else if(j==n+1){
				last[l]=i;
				//cout <<last[l]<<" "<<l<<endl;
			}
		}
	}
	for(int i=1;i<w+1;i++){
		cout<<last[i]<<endl;
	}
}

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

int main(){

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

    return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
void swap(int* a,int s,int v){
int c;
c=a[s];
a[s]=a[v];
a[v]=c;
return;
}
int main(){
int w,n;
int ans[100];
int sw[2];
scanf("%d %d",&w,&n);
int i;
for(i=1;i<=w;i++){
ans[i]=i;
}
for(i=0;i<n;i++){
sw[1]=sw[0]=0;
scanf("%d,%d",&sw[0],&sw[1]);
swap(ans,sw[0],sw[1]);
}
for(i=1;i<=w;i++){
printf("%d\n",ans[i]);
}
return 0;
}