Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	lines, _ := strconv.Atoi(sc.Text())
	l := make([]int, lines)
	for i := 0; i < lines; i++ {
		l[i] = i + 1
	}

	sc.Scan()
	rows, _ := strconv.Atoi(sc.Text())
	for i := 0; i < rows; i++ {
		sc.Scan()
		s := strings.Split(sc.Text(), ",")
		a, _ := strconv.Atoi(s[0])
		b, _ := strconv.Atoi(s[1])

		l[a-1], l[b-1] = l[b-1], l[a-1]
	}
	for _, j := range l {
		fmt.Println(j)
	}
}

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

using namespace std;

void solve(int w,int n){
  vector<int> v;
  for(int i=0;i<w+1;i++){
    v.push_back(i);
  }
  for(int i=0;i<n;i++){
    int a,b;
    char c;
    cin >> a >>c>> b;
    int temp = v[a];
    v[a] = v[b];
    v[b] = temp;
  }
  for(int i=1;i<w+1;i++){
    cout << v[i] << endl;
  }
}
int main(){
  int w,n;
  cin >> w;
  cin >> n;
  solve(w,n);
  return 0;
}

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

int main(){
	int w;
	cin>>w;
	vector<int> x(w);
	for(int i=0;i<w;i++)x[i]=i+1;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		int a=s[0]-'0';
		int b=s[2]-'0';
		a--;
		b--;
		int tmp=x[a];
		x[a]=x[b];
		x[b]=tmp;
	}
	for(int i=0;i<w;i++)cout<<x[i]<<endl;
	return 0;
}

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

int main() {

	int place[31];
	int w, n;
	cin >> w >> n;
	for(int i = 1; i <= w; i++)
		place[i] = i;
	
	int a, b;
	char c;
	for(int i = 1; i <= n; i++){
		cin >> a >> c >> b;
		
		int temp = place[a];
		place[a] = place[b];
		place[b] = temp;
	}
	
	for(int i = 1; i <= w; i++)
		cout << place[i] << endl;
	
	return 0;
}

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


using namespace std;


int main(){
    
    int w,n,a,b;
    cin >> w >> n;
    vector<int> ans;
    for(int i=0;i<=w;i++){
        ans.push_back(i);
    }

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

C++: #include <iostream>

using namespace std;

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

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

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

C++: #include<algorithm>
#include<iostream>
using namespace std;
int main(){
	int w,n;
	cin>>w>>n;
	int a[w],b[w];
	for(int i=0;i<n;i++){
		swap(a[n],b[n]);
	}
	for(int j=0;j<w;j++){
		cout<<a[j]<<endl<<b[j]<<endl;
	}
}

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

struct THorizonalLine
{
	int Left;
	int Right;
};

int main()
{
	int w;
	cin >> w;
	int n;
	cin >> n;
	vector<int> StartingPoint(w);
	for(int i = 0; i < w; i++){
		StartingPoint[i] = i+1;
	}
	for(int i = 0; i < n; i++){
		THorizonalLine HorizonalLine;
		scanf("%d,%d",&HorizonalLine.Left,&HorizonalLine.Right);
		swap(StartingPoint[HorizonalLine.Left-1], StartingPoint[HorizonalLine.Right-1]);
	}
	for(int i = 0; i < w; i++){
		cout << StartingPoint[i] << endl;
	}
	return 0;
}

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

using namespace std;

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

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

	while (n--)
	{
		int a, b;
		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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int w, n, a, b;

	cin >> w >> n;
	auto hlines = vector<int>(w);
	for (int i = 0; i < w; ++i) {
		hlines.at(i) = i + 1;
	}

	for (int i = 0; i < n; ++i) {
		cin >> a;
		cin.ignore();
		cin >> b;
		--a, --b;
		swap(hlines.at(a), hlines.at(b));
	}
	for (int const x : hlines) {
		cout << x << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

int n;
int w;
int line[30][2];
int perm[31];

int main() {
	cin >> n;
	cin >> w;
	for (int i = 0; i < w; i++) {
		char str[3];
		cin >> str;
		line[i][0] = str[0] - '0';
		line[i][1] = str[2] - '0';
	}

	for (int i = 1; i <= n; i++) {
		int pt = i;
		for (int j = 0; j < w; j++) {
			if (line[j][0] == pt) pt = line[j][1];
			else if (line[j][1] == pt) pt = line[j][0];
		}
		perm[pt] = i;
	}

	for (int i = 1; i <= n; i++) {
		cout << perm[i] << endl;
	}

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

C++: #include <stdio.h>

int main(){

	int w = 0, y = 0, i, t[30] = {},a=0,b=0;

	scanf("%d%d", &w, &y);

	for (i = 0; i < w; i++){
		t[i] = i+1;
	}
	for (i = 0; i < y; i++){
		scanf("%d,%d", &a, &b);
		int k = 0;
		k = t[a - 1];
		t[a - 1] = t[b - 1];
		t[b - 1] = k;
	}
	for (i = 0; i <= y; i++){
		printf("%d\n",t[i]);
	}

	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, c;
		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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main( void )
{
	int w, n;
	cin >> w >> n;
	vector <int> S(w);
	for ( int i = 0; i < w; i++ )
		S[i] = i+1;

	for ( int i = 0; i < n; i++ )
	{
		int a, b;
		char c;
		cin >> a >> c >> b;
		swap( S[a-1], S[b-1] );
	}

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

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int w,n;
    int a[30]={-1};
    int j,k;
    int temp1;
    
    while(cin >> w){
        
        if(w==0)break;

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

        cin >> n;       

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

            cin >> j >> temp >> k;
            
            temp1=a[j-1];
            a[j-1]=a[k-1];
            a[k-1]=temp1;

        }

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

    return 0;
}