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