#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,m,lots[50];
  cin >>n>>m;
  for(int i=0; i<50; i++){lots[i] = i+1;}
  while(m--){
    int a,b,c;
    scanf("%d,%d",&a,&b);
    c = lots[a-1];
    lots[a-1] = lots[b-1];
    lots[b-1] = c;
  }
  for(int i=0; i<n; i++){cout <<lots[i]<<endl;}
  return 0;
}