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++: import java.util.Scanner;
public class Main{
	private static void change(int data[],int f,int s){
		int temp = data[f-1];
		data[f-1] = data[s-1];
		data[s-1] = temp;
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int w = scan.nextInt();
		int n = scan.nextInt();
		int[] data = new int[w];
		for(int i=0;i<w;i++){
			data[i]=i+1;
		}
		int first =0;
		int second =0;
		scan.useDelimiter(",");
		for(int i=0;i<n;i++){
			first = scan.nextInt();
			second = scan.nextInt();
			change(data,first,second);
		}
		for(int i=0;i<=n;i++)
			System.out.println(data[i]);
	}

}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int w, n, x, y, tmp;
  char c;
  VI v;

  cin >> w >> n;

  FOR(i, 0, w) v.PB(i+1);
  FOR(i, 0, n) {
    cin >> x >> c >> y;
    tmp = v[x-1];
    v[x-1] = v[y-1];
    v[y-1] = tmp;
  }
  FOR(i, 0, w) cout << v[i] << endl;
}

C++: #include <iostream>

using namespace std;

int main(){
	int w, n;
	cin >> w >> n;
	int s[w];

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

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

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

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

	return 0;
}

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

using namespace std;

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

    vector<int> v(w);
    iota(v.begin(), v.end(), 1);

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

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

    return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
 
using namespace std;
 
int main(){
 
    int w,n,left,right;
    scanf("%d",&w);
    int array[w+1];
    for(int i=0;i<w+1;i++)array[i]=i;
    scanf("%d",&n);
 
    for(int i=0;i<n;i++){
        scanf("%d,%d",&left,&right);
        swap(array[left],array[right]);
    }
 
    for(int i=1;i<=w;i++){
        printf("%d\n",array[i]);
    }
 
    return 0;
}

C++: #include <stdio.h>

void swap(int* a,int* b);

int main(void) {

  int w,n;
  int seq[50];
  int a,b;
  int i,temp;
  
  scanf("%d",&w);

  for(i=0;i<w;i++) seq[i]=i+1;

  scanf("%d",&n);

  for(i=0;i<n;i++) {
    scanf("%d,%d",&a,&b);
    swap(seq+a-1,seq+b-1);
    }

  for(i=0;i<5;i++) printf("%d\n",seq[i]);
 
  return 0;
}

void swap(int* a,int* b) {
  int temp;

  temp=*a;
  *a=*b;
  *b=temp;
}

C++: #include <stdio.h>

int main(){
	int w,n;
	scanf("%d%d", &w,&n);

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

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

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

C++: #include<bits/stdc++.h>
using namespace std;
inline int nextInt(void){
	int res=0;
	char ch=getchar();
	while(ch>'9'||ch<'0')
		ch=getchar();
	while(ch<='9'&&ch>='0'){
		res=res*10+ch-'0';
		ch=getchar();
	}
	return res;
}
signed main(void){
	int n=nextInt(),m=nextInt();
	int ans[n+1],line[m+1][2];
	for(int i=1;i<=m;i++){
		line[i][0]=nextInt();
		line[i][1]=nextInt();
	}
	for(int i=1,t;i<=n;i++){
		t=i;
		for(int d=1;d<=m;d++){
			if(line[d][0]==t)
				t=line[d][1];
			else if(line[d][1]==t)
				t=line[d][0];
		}
		ans[t]=i;
	}
	for(int i=1;i<=n;i++)
		cout<<ans[i]<<endl;
}

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

int main()
{
	int w, n;
	cin >> w >> n;
	const int MAX_N = 30 + 1;
	int a[MAX_N];
	for (int i = 1; i <= w; i++) {
		a[i] = i;
	}
	int x, y;
	while (n--) {
		scanf("%d,%d", &x, &y);
		int tmp = a[y];
		a[y] = a[x];
		a[x] = tmp;
	}
	for (int i = 1; i <= w; i++) {
		cout << a[i] << endl;
	}
    return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
int w,n;
cin>>w>>n;
vector<int> number(w);
REP(i, w){
	number[i]=i+1;
}
REP(i,n){
string s,s2;
	getline(cin, s,',');
	getline(cin, s2);
	int a,b;
	a = atoi(s.c_str());
	b = atoi(s2.c_str());
	int t=number[a-1];
	number[a - 1] = number[b-1];
	number[b - 1]=t;
}
REP(i, w)
cout << number[i]<<endl;
}