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 <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int w, n;
	vector<int> vertical;
	vector< pair<int,int> > horizontal;
	string buffer;

	cin >> w;

	for ( int i = 1; i <= w; i++ )
	{
		vertical.push_back( i );
	}

	cin >> n;

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

		for ( unsigned int i = 0; i < buffer.size(); i++ )
		{
			if ( buffer[i] == ',' )
			{
				buffer[i] = ' ';
				break;
			}
		}

		int a, b;
		sscanf( buffer.c_str(), "%d %d", &a, &b );

		horizontal.push_back( make_pair( a - 1, b - 1 ) );
	}

	for ( unsigned int i = 0; i < horizontal.size(); i++ )
	{
		swap( vertical[ horizontal[i].first ], vertical[ horizontal[i].second ] );
	}
	

	for ( unsigned int i = 0; i < vertical.size(); i++ )
	{
		cout << vertical[i] << endl;
	}

	return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
int s[31];
int main()
{
	int i,n,m,w,a,b,p;
	char d;
	cin>>w;
	for(i=1;i<=w;i++)s[i]=i;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a>>d>>b;
		p=s[a];s[a]=s[b];s[b]=p;
	}
	for(i=1;i<=w;i++)cout<<s[i]<<endl;
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<string>
#include<random>
using namespace std;


int main(){

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

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

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

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


  return 0;
}














// EOF

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

int main() {
	int n, w;
	cin >> n >> w;
	vector<int> v(n);

	for(int i = 0; i < n; i++) {
		v[i] = i+1;
	}

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

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

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

int main()
{
    int w;
    std::cin >> w;
    std::vector<int> v(w);
    for(int i = 0; i < w; ++i){
        v[i] = i+1;
    }
    int n;
    std::cin >> n;
    for(int i = 0; i < n; ++i){
        int a, b;
        char c;
        std::cin >> a >> c >>  b;
        std::swap(v[a-1], v[b-1]);
    }
    for(int i = 0; i < w; ++i){
        std::cout << v[i] << std::endl;
    }
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int w, n;
    cin >> w >> n;
    vector<int> num(w);
    for(int i=0; i<w; ++i)
        num[i] = i+1;

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

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

    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
inline void swap(int amida[], int a, int b){
	int tmp = amida[a];
	amida[a] = amida[b];
	amida[b] = tmp;
}
int main(){
	int amida[40];
	int w,n,a=0,b=0;
	for(int i=0; i<40; i++)
		amida[i] = i;
	cin >> w >> n;
	for(int i=0; i<n; i++){
		scanf("%d,%d",&a,&b);
		swap(amida,a,b);
	}
	for(int i=1; i<=w; i++)
		cout << amida[i] << endl;
	
	return 0;
	
}

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

int main() {

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

    vector<int> member(w);
    for (int m = 0; m < w; m++) {
        member[m] = m;
    }

    for (int t = 0; t < n; t++) {
        int a, b;
        char sep;
        cin >> a >> sep >> b;

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

    for (int m = 0; m < w; m++) {
        cout << member[m]  + 1 << endl;
    }
     
    return 0;
}

C++: #include<iostream>
#include<stdlib.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

void swap(int& x, int& y) {
  int tmp = x;
  x = y;
  y = tmp;
}

int main() {
  int w, n;
  int ws[30];
  cin >> w;
  REP(i,w-1) { ws[i] = i+1; }
  cin >> n;
  REP(i,n-1) { 
    string s;
    int a, b;
    cin>>s;
    a=atoi((s.substr(0,s.find(","))).c_str());
    b=atoi((s.substr(s.find(",")+1)).c_str());
    swap(ws[a], ws[b]);
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
        int n = 0;
        cin >> n;

        int count = 0;
        cin >> count;

        int i;

        int num[n];

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

        int a,b;
        int temp;

        for(i = 0;i < count;i++)
        {
                scanf("%d,%d",&a,&b);
                temp = num[a-1];
                num[a-1] = num[b-1];
                num[b-1] = temp;
        } 
        for(i = 0;i < n;i++)
        {
                cout << num[i] << endl;
        } 

}

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

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

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

int graph[40][40];
int ans[40];

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

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

  for(int i = 1; i <= w; i++)
  {
    int x = i;
    for(int y = 1; y <= n; y++)
    {
      if(graph[x][y])
	x = graph[x][y];
    }
    ans[x] = i;
  }

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

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

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

C++: #include <stdio.h>

int main()
{
	int w,n,a,b;
	int ans[30],temp;

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

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

	for(int i = 0; i < w; i++){
		printf("%d\n",ans[i]);
	}

	return 0;
}

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


#define MAX 30


int in[MAX];

int w , n;

int Left , Right;


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

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

	for (int i = 0; i < n; i++)
	{
		scanf("%d,%d" , &Left , &Right);

		int tmp = in[Left - 1];
		in[Left - 1] = in[Right - 1];
		in[Right - 1] = tmp;
	}

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

	return 0;
}