Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func swap(ints []int, i, j int) {
	ints[i], ints[j] = ints[j], ints[i]
}

func main() {
	w := nextInt()
	// println(w)
	nums := make([]int, w)
	for i := range nums {
		nums[i] = i+1
	}
	n := nextInt()
	// println(n)
	for i := 0; i < n; i++ {
		info := nextString()
		// println(info)
		infos := strings.Split(info, ",")
		a, _ := strconv.Atoi(infos[0])
		b, _ := strconv.Atoi(infos[1])
		swap(nums, a-1, b-1)
	}
	for _, v := range nums {
		fmt.Println(v)
	}
}

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

using namespace std;

int horizontalLine,verticalLine;
int A,B;
char UserInput[10];

int main()
{
        cin >> verticalLine;
        cin >> horizontalLine;
        if((verticalLine < 0 || horizontalLine < 0) || (verticalLine > 30 || horizontalLine > 30))
        {
            return 0;

        }

        int NumberExist[verticalLine];
        for(int y = 1; y <= verticalLine; y++)
        {
            NumberExist[y-1] = y;
        }

        for(int x = 1; x <= horizontalLine; x++)
        {
            cin >> UserInput;
            A = UserInput[0] - '0';
            B = UserInput[2] - '0';
            int TempVariable;
            TempVariable = NumberExist[A-1];
            NumberExist[A-1] = NumberExist[B-1];
            NumberExist[B-1] = TempVariable;

        }

        for(int z = 0; z < verticalLine; z++)
        {
            cout << NumberExist[z] << endl;
        }


}

C++: a = (1..gets.to_i).to_a
gets.to_i.times{
	x,y = gets.split(",").map(&:to_i)
	a[x-1], a[y-1] = a[y-1], a[x-1]
}
puts a

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

using namespace std;

void swap(int *var1, int *var2) {
  int tmp = *var1;
  *var1 = *var2;
  *var2 = tmp;
}

int main() {
  int w;
  int n;

  cin >> w;
  cin >> n;

  int vertical_line[w];
  for (int v_i = 0; v_i < w; v_i++)
    vertical_line[v_i] = v_i;

  for (int n_i = 0; n_i < n; n_i++) {
    int node1, node2;
    scanf("%d %d", &node1, &node2);
    swap(vertical_line+node1, vertical_line+node2);    
  }

  for (int v_i = 0; v_i < w; v_i++)
    cout << vertical_line[v_i] << endl;

  return 0;
}

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

struct Line{
  int a,b;
};

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

  vector<Line> h_line(n);
  vector<int> ans(w);

  // input
  for(int i=0,a,b;i<n;++i){
    scanf("%d,%d", &a, &b);
    h_line[i].a = a;
    h_line[i].b = b;
  }

  // solve
  for(int i=1;i<=w;++i){
    int now = i;
    for(int j=0;j<n;++j){
      if(h_line[j].a == now)
        now = h_line[j].b;
      else if(h_line[j].b == now)
        now = h_line[j].a;
    }
    ans[now-1] = i;
  }

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

  return EXIT_SUCCESS;
}

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

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

C++: #include <iostream>
using namespace std;
 
int main(){
 
int w, n;
int num[30]={0};
int a, b;
 
for(int i=0; i<w; i++)
num[i]=i+1;
 
cin>>w;
cin>>n;
 
for(int i=0; i<n; i++){
 
cin>>a>>b;
 
int tmp=num[a];
num[a]=num[b];
num[b]=tmp;
 
 
}
 
 
for(int i=0; i<w; i++)
cout<<num[i]<<"\n";
 
return 0;
 
}

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