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<iostream>

int listen_lineCount();
void listen_path(int &from,int &to);

class Lots
{
private:
	int *start_goal;
	int verLineNum;
public:
	Lots(const int lineCount);
	~Lots();
	
	void draw_line(const int from,const int to);
	void echo_goalNums();
};

//-------------------------main--------------------------------

int main()
{
	int ver_lineCount=listen_lineCount();
	Lots inst_lot=Lots(ver_lineCount);
	
	int hor_lineCount=listen_lineCount();
	
	int from,to;
	for(int roop=0;roop<hor_lineCount;roop++)
	{
		listen_path(from,to);
		inst_lot.draw_line(from,to);
	}
	
	inst_lot.echo_goalNums();
	return 0;
}

//--------------------------------------------------------------

Lots::Lots(const int lineCount)
{
	verLineNum=lineCount;
	start_goal=new int(lineCount+1);
	
	for(int roop=1;roop<=lineCount;roop++)
	{
		start_goal[roop]=roop;
	}
}

Lots::~Lots()
{
	delete [] start_goal;
}

void Lots::draw_line(const int from,const int to)
{
	int swap=start_goal[from];
	start_goal[from]=start_goal[to];
	start_goal[to]=swap;
}

void Lots::echo_goalNums()
{
	using namespace std;
	
	for(int roop=1;roop<=verLineNum;roop++)
	{
		cout<<start_goal[roop]<<endl;
	}
}


int listen_lineCount()
{
	using namespace std;
	
	int lineCount;
	cin>>lineCount;
	
	return lineCount;
}

void listen_path(int &from,int &to)
{
	using namespace std;
	
	char delim;//カンマ区切り
	
	cin>>from>>delim>>to;
}

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

int w,n ;
int x,y ;

int LenLine[31] ;

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

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

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

		swap( LenLine[x] , LenLine[y] ) ;
	}

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

	return 0 ;
}

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

int main(){
  int w,n;
  scanf("%d\n%d",&w,&n);
  int v[w+1],s1,s2;
  for(int i=1;i<=w;i++) v[i]=i;
  for(int i=0;i<n;i++){
    scanf("%d,%d",&s1,&s2);
    swap(v[s1],v[s2]);
  }
  for(int i=1;i<=w;i++) printf("%d\n",v[i]);
  return 0;
}

C++: 

#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>

using namespace std;

const int MAX_HORIZONTAL = 30;
const int MAX_VERTICAL = 30;

int main(){

	int VerticalLines;
	int HorizontalLines;
	int HorizonA[MAX_HORIZONTAL];
	int HorizonB[MAX_HORIZONTAL];
	int Results[MAX_VERTICAL];



	cin >> VerticalLines;
	cin >> HorizontalLines;
	for (int i = 0; i < HorizontalLines; ++i){ char c[32];  scanf("%d,%d", &HorizonA[i], &HorizonB[i]); }

	for (int i = 0; i < VerticalLines; ++i){ Results[i] = i + 1; }

	

	for (int i = 0; i < HorizontalLines; ++i){
		int Swap = Results[HorizonA[i] - 1];
		Results[HorizonA[i]-1] = Results[HorizonB[i] - 1];
		Results[HorizonB[i] - 1] = Swap;
	}

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





	return 0;
}

C++: #include <iostream>
#include<stdio.h>
#define for1(be,end,z) for(z=be;z<end;z++)
#define for2(end,z) for1(0,end,z)

using namespace std;
int g_lost[30];
/*void init()
{
    int i;
    for2(30,i)
    {
        g_lost[i]=i+1;
    }
}
void swap1(int a,int b)
{
    int tp;
    tp=g_lost[a-1];
    g_lost[a-1]=g_lost[b-1];
    g_lost[b-1]=tp;
}*/
int main()
{
    int w,n,i,tp;
    cin>>w>>n;
    int data[w];
    for2(w,i)
    {
        data[i]=i+1;
    }
    while(n--)
    {
        int a,b;
        scanf("%d,%d", &a, &b);
        tp=data[a-1];
        data[a-1]=data[b-1];
        data[b-1]=tp;
    }
    for2(w,i)
    {
        cout<<data[i]<<endl;
    }
    return 0;
}

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 <cstdio>
#include <iostream>
using namespace std;

int main()
{
  int w,n;
  int c[]={0};
  int a,b;
  //  int temp;

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

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

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

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

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

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

C++: #include <iostream>

using namespace std;

int main() {
	int a[31];
	for(int i=0;i<31;i++){
		a[i] = i;
	}
	int w,n;
	cin >> w;
	cin >> n;
	int k,l;
	while(scanf("%d,%d",&k,&l)+1){
		a[0] = a[k];
		a[k] = a[l];
		a[l] = a[0];
	}
	for(int i=1;i<=w;i++){
		cout << a[i] << endl;
	}
	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>
using namespace std;
int x[40], n, w, a, b, c, d; char f;
int main() {
	cin >> n >> w;
	for (int i = 1; i <= n; i++) {
		x[i] = i;
	}
	for (int i = 0; i < w; i++) {
		cin >> a >> f >> b;
		c = x[a];
		d = x[b];
		x[a] = d;
		x[b] = c;
	}
	for (int i = 1; i <= n; i++) {
		cout << x[i] << endl;
	}
}

C++: #include <vector>
#include <iostream>
using namespace std;
 
int main(){
    int w, n,a,b;
    char c;
    vector<int> ans;
    cin >> w >> n;


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

         swap(ans[a], ans[b]);
    }
 
    for (int i = 1; i <= w; i++)
    cout << ans[i] << endl;
}

C++: #include <stdio.h>

int main()
{
	int w, n, a, b, x, rs[30];

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

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

		printf("%d\n", rs[i]);
	}

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

		x = rs[a-1];
		rs[a-1] = rs[b-1];
		rs[b-1] = x;
	}

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

C++: #include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
  int w;
  while (cin >> w) {
    vector<int> vec;
    vec.resize(w);
    for (int i = 0; i < vec.size(); ++i) {
      vec[i] = i + 1;
    }
    int n;
    cin >> n;
   //  cin.ignore(INT_MAX, '\n');
    for (int i = 0; i < n; ++i) {
      string str, tmp_a, tmp_b;
      int a, b;
      getline(cin, str);
      istringstream iss(str);
      getline(iss, tmp_a, ',');
      getline(iss, tmp_b, ',');
      a = stoi(tmp_a) - 1;
      b = stoi(tmp_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;
}