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 <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>

using namespace std;

const double PI=3.14159265;

int main()
{
	int n,w,a,b,*ans;
	cin>>w>>n;

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

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

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

	return 0;

}

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

int main() {

  int w,n;
  cin >> w >> n;

  int num[30];
  for ( int i = 0; i < w; i++ ) {
    num[i] = i;
  }

  for ( int i = 0; i < n; i++ ) {

    int a,b;
    char c;
    cin >> a >> c >> b;
    int k;
    k = num[a-1];
    num[a-1] = num[b-1];
    num[b-1] = k;

  }

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

  return 0;

}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
//	cut here before submit 
//	freopen ("testcase.DL", "r", stdin );
	int w;
	scanf ("%d", &w );
	vector<int> a (w+1, 0 );
	for (int i = 1; i <= w; i++ ) a[i] = i;
	int n;
	scanf ("%d", &n );
	rep (i, n ){
		string s = "";
		cin >> s;
		rep (j, s.length() ){
			if (s[j] == ',' ) s[j] = ' ';
		} // end rep
		stringstream ss (s );
		int b1, b2;
		ss >> b1 >> b2;
		swap (a[b1], a[b2] );
	} // end rep
	for (int i = 1; i <= w; i++ ){
		printf ("%d\n", a[i] );
	} // end for

	return 0;
}

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

using namespace std;

int main() {
	int N, M; cin >> N >> M;
	vector<int> v(N);
	for (int i = 0; i < N; ++i) {
		v[i] = i;
	}
	for (int i = 0; i < M; ++i) {
		int a, b; scanf("%d,%d", &a, &b); --a, --b;
		swap(v[a], v[b]);
	}
	for (int i = 0; i < N; ++i) {
		cout << v[i]+1 << endl;
	}
}

C++: #include<iostream>

using namespace std;

int main()
{
	int w;
	int n;

	cin >> w >> n;
	int ws[w+1];

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

	for(int i = 0; i < n; ++i){
		int a,b;
		int tmp;
		char d;
		cin >> a >> d >>b;
		tmp   = ws[a];
		ws[a] = ws[b];
		ws[b] = tmp;
	}
	
	for(int i = 1; i <= w; ++i)cout << ws[i] << endl;

	return 0;
}

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <cstdint>

int main()
{
	std::uint16_t w, n;
	std::cin >> w;
	std::cin >> n;

	std::vector<std::uint16_t> vnumbers(w);
	std::iota(vnumbers.begin(), vnumbers.end(), 1);

	for (int i = 0; i < n; ++i) {
		std::uint16_t a, b;
		char comma;
		std::cin >> a >> comma >> b;
		std::swap(vnumbers[a - 1], vnumbers[b - 1]);
	}

	std::copy(vnumbers.begin(), vnumbers.end(),
			std::ostream_iterator<std::uint16_t>(std::cout, "\n"));

	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<stdlib.h>

using namespace std;

int main(void) {


	//0011
	int Line[31], w=0, n=0, a, b, tmp;
	cin >> w;
	cin >> n;
	for (int i=0; i < 30; i++) {
		Line[i] = i;
	}
	for (int j = 0; j < n; j++) {
		scanf_s("%d,%d", &a, &b);
		tmp = Line[a];
		Line[a] = Line[b];
		Line[b] = tmp;
	}
	for (int k = 1; k <= w; k++) {
		cout << Line[k] << endl;
	}


	return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, m;
	cin >> n >> m;
	
	vector<int> vec(n + 1);
	for(int i = 1; i <= n; ++i){
		vec[i] = i;
	}
	
	for(int i = 0; i < m; ++i){
		int a, b;
		char c;
		cin >> a >> c >> b;
		swap(vec[a], vec[b]);
	}
	
	for(int i = 1; i <= n; ++i){
		cout << vec[i] << endl;
	}
	
	return 0;
}

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;
}

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

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

C++: #include<iostream>
#include<vector>
#include <stdio.h>
int main(){
	int w;
	std::cin>>w;
	std::vector<int> a(w);
	for(int i=1;i<=w;i++)a[i]=i;
	int n;
	std::cin>>n;
	while(n>0){
		int b,c;
		scanf("%d,%d",&b,&c);
		//std::cin>>b>>c;
		int d=a[b];
		a[b]=a[c];
		a[c]=d;
		n--;
	}
	for(int i=1;i<=w;i++)std::cout<<a[i]<<std::endl;
	return 0;
}