#include<stdio.h>
int main()
{
  int n,m,i;
  int line[101];
  int a,b;
  scanf("%d",&n);

  for(i = 1;i <= n;i++)line[i] = i;

  scanf("%d",&m);

  for(i = 0;i < m;i++){
    scanf(" %d %d",&a,&b);
    int temp = line[a];
    line[a] = line[b];
    line[b] = temp;
  }
  
  for(i = 1;i <= n;i++)printf("%d ",line[i]);
  printf("\n");
}