#include <iostream>
using namespace std;

int main() {

  int w,n;
  cin >> w >> n;

  int num[30];
  for ( int i = 0; i < w; i++ ) {
    num[i] = i;
  }

  for ( int i = 0; i < n; i++ ) {

    int a,b;
    char c;
    cin >> a >> c >> b;
    int k;
    k = num[a-1];
    num[a-1] = num[b-1];
    num[b-1] = k;

  }

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

  return 0;

}