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

using namespace std;

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

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

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

C++: #include <iostream>

int main(){
	int a,b,c,g,h;
	std::cin>>a>>b;
    int d[a];
    for(int e=1;e<=a;e++){
    	d[e]=e;
    	
	}
	for(int f=0;f<b;f++){
		std::cin>>g>>h;
		c=d[g];
		d[g]=d[h];
		d[h]=c;
	}
	for(int i=1;i<=a;i++){
		std::cout<<d[i]<<std::endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n, m, lot[30];
	scanf("%d %d",&n,&m);
	for(int i=0; i<n; i++){lot[i] = i+1;}
	while(m--){
		int a, b;
		scanf("%d,%d",&a,&b);
		swap(lot[a-1],lot[b-1]);
	}
	for(int i=0; i<n; i++){printf("%d\n",lot[i]);}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define M 10000000
#define bag cout<<"here\n"
using namespace std;
int main()
{
    long int v,h,a,b,c;
    while(cin>>v)
    {
        int arr[v];
        for(int i=0;i<v;i++)
          arr[i]=i+1;
        cin>>h;
        for(int i=1;i<=h;i++)
        {
           scanf("%d %*c %d",&a,&b);
           swap(arr[a-1],arr[b-1]);
        }
        for(int i=0;i<v;i++)
          cout<<arr[i]<<endl;
    }
    return 0;
}

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



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

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

using namespace std;
void swap_my(int &a,int &b){
  int keep = a;
  a = b;
  b = keep;
  
}
int main(){
  int w,n;
  cin >> w >> n;
  vector<int> status(w,0);
  for(int i = 0;i < w;i++){
	status[i] = i;
  }
  for(int i = 0;i < n;i++){
	int a,b;
	scanf("%d,%d",&a,&b);
	swap_my(status[a-1],status[b-1]);
  }
  for(int i = 0;i < w;i++){
	cout << status[i]+1 << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int w,n,a,b,z;
    char q;
    cin>>w>>n;
    vector<int> ans(n);
    for(int i=0;i<w;i++){
        ans[i]=i+1;
    }
    for(int i=0;i<n;i++){
        cin>>a>>q>>b;
        z=ans[a-1];
        ans[a-1]=ans[b-1];
        ans[b-1]=z;
    }
    for(int i=0;i<w;i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include<string>
using namespace std;
int main() {
    int line;
    int side;
    int sidenum1,sidenum2;
    int linenum[line];
    char waste;
    cin>>line>>side;
    for(int i=0; i<line; i++){
        linenum[i]=i+1;
    }
    for(int i=0; i<side; i++){
        cin>>sidenum1>>waste>>sidenum2;
        swap(linenum[sidenum1-1],linenum[sidenum2-1]);
    }
    for(int i=0; i<line; i++){
        cout<<linenum[i]<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<string>
#include<cmath>
typedef long long int ll;
#define VI vector<int>

#define rep(i,a) for(int i=0;i<(a);i++)
#define all(i) i.begin(),i.end()
#define INF 1000000000


using namespace std;


/**/
VI y;
pair<int,int> x[31];


int main(){
	int w,n;
	rep(i,31){
		y.push_back(i);
	}
	cin>>w>>n;
	rep(i,n){
		char c;
		cin>>x[i].first>>c>>x[i].second;
		x[i].first--,x[i].second--;
	}
	rep(i,n){
		swap(y[ x[i].first ],y[ x[i].second ]);
	}
	rep(i,w){
		cout<<y[i]+1<<endl;
	}

	return 0;
}

C++: #include <iostream>
#include<cstdio>
using namespace std;
int main (){
	int w,N,d[31],sub;
	int a,b;

	cin>>w>>N;
	for(int j=1;j<=w;j++){
		d[j]=j;
	}
	for(int i=0;i<N;i++){
        scanf("%d,%d",&a,&b);
		sub=d[b];
		d[b]=d[a];
		d[a]=sub;
	}
	for(int k=1;k<=w;k++){
	cout<<d[k]<<endl;
	}

	return 0;
}

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

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

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

	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main() {
int w, n;
cin >> w >> n;
vector<int> vec;
for (int i = 0; i < w; ++i) {
  vec.push_back(i + 1);
}
for (int i = 0; i < n; ++i) {
  int a, b;
  scanf("%d,%d", a, b);
  a -= 1;
  b -= 1;
  int tmp = vec[a];
  vec[a] = vec[b];
  vec[b] = tmp;
}
for (int i = 0; i < vec.size(); ++i) {
  cout << vec[i] << endl;
}
return 0;
}

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

void Swap(int arr[], int x, int y){
    int temp;
    temp = arr[x];
    arr[x] = arr[y];
    arr[y] = temp;
}

int main(){

    int w, n;
    cin >> w >> n;
    vector<int> arr(w+1);

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

    for(int m=0; m<n; m++){
        int a, b;
        scanf("%d,%d", &a, &b);

        Swap(arr.data(), a, b);
    }

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


    return 0;
}