Go: package main

import "fmt"

func main() {
	var w, n, a, b, i, te int
	var amida [31]int
	fmt.Scanf("%d", &w)
	fmt.Scanf("%d", &n)
	for i := 1; i <= w; i++ {
		amida[i] = i
	}
	for i := 1; i <= n; i++ {
		fmt.Scanf("%d,%d", &a, &b)
		te = amida[a]
		amida[a] = amida[b]
		amida[b] = te
	}
	for i := i; i <= w; i++ {
		fmt.Printf("%d\n", amida[i])
	}
}

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

C++: #include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <stdlib.h>

using namespace std;

int main (void)
{
	int n,m,a[31],b[31];

	cin >> n >> m;

	char o;

	for (int i = 0; i < m; i++)
	{
		cin >> a[i] >> o >> b[i];
	}

	int p[31];

	for (int j = 1; j < n + 1; j++)
	{
		p[j] = j;
	}

	for (int i = 0; i < m; i++)
	{
		int ha = 0,hb = 0;

		ha = p[b[i]];
		hb = p[a[i]];

		p[a[i]] = 0;
		p[a[i]] = ha;

		p[b[i]] = 0;
		p[b[i]] = hb;
	}

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

C++: #include<iostream>

using namespace std;
 
int main() {
	
    int L[30];
    for(int i=0;i<30;i++)
	L[i]= i + 1;
	
    int a,b;
    cin >> a >> b;
    for(int i=0;i<b;i++){
    	
        int c,d;
        cin >> c >> d;
        
        int s = L[c-1];
        L[c-1] = L[d-1];
        L[d-1] = s;
        
    }
    for(int i=0;i<a;i++)
	cout << L[i] << "\n";
	return 0;
}

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

int main() {
	int w, n;
	string str;
	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;
		string str;
		cin >> str;
		a = str[0] - '0';
		b = str[2] - '0';
		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 <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#define INF 1000000000
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define all(x) (x).begin(),x.end()
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;

int main(){
  int w,n;
  int array[35];
  cin>>w>>n;
  REP(i,1,w+1)array[i]=i;
  rep(i,n){
    int a,b;
    cin>>a;
    getchar();
    cin>>b;
    swap(array[a],array[b]);
  }
  for(int i=1;i<=w;i++){
    cout<<array[i]<<endl;
  }
  return 0;
}

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