#include <iostream>

using namespace std;

void swap(int &x,int &y);
int main(){
  int *line=NULL,w,n;
  
  cin>>w;
  cin>>n;

  line=new int[w];
  for( int i=0;i<w;i++ )
    line[i]=i+1;
  for( int i=0;i<n;i++ ){
    int a,b;
    char c;
    cin>>a>>c>>b;
    swap(line[a-1],line[b-1]);
  }
  for( int i=0;i<w;i++ )
    cout<<line[i]<<endl;
  delete line;
  line = 0;
  return 0;
}

void swap(int &x,int &y){
  x^=y;
  y^=x;
  x^=y;
}