#include <iostream>
#include <cstdio>

using namespace std;

int main(){

  int w, n, a, b;

  cin >> w >> n;

  int lot[w];

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

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

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

}