#include <iostream>
#include <cstdio>

using namespace std;

int main(int argc, char *argv[]) {
  int ver, hor;

  cin >> ver;
  cin >> hor;
  int nums[ver];
  for (int i = 0; i < ver; i++)
    nums[i] = i+1;
  
  int tmp, a, b;
  for (int i = 0; i < hor; i++) {
    scanf("%d,%d", &a, &b);
    a--; b--;
    tmp = nums[a];
    nums[a] = nums[b];
    nums[b] = tmp;
  }

  for (int i = 0; i < ver; i++)
    cout << nums[i] << endl;
  return 0;
}