Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	w := nextInt()
	n := nextInt()

	numbers := make([]int, w+1)
	for i := 1; i <= w; i++ {
		numbers[i] = i
	}

	for i := 0; i < n; i++ {
		line := nextString()
		words := strings.Split(line, ",")
		a, _ := strconv.Atoi(words[0])
		b, _ := strconv.Atoi(words[1])

		numbers[a], numbers[b] = numbers[b], numbers[a]
	}

	for i := 1; i <= w; i++ {
		fmt.Println(numbers[i])
	}
}

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

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