import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;
public class Main{
	public static void main(String args[]){
    int a=0,b=0,c=0,i=0,n=0,j=0,m=0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


    try{
      String line = reader.readLine();
      n = Integer.parseInt(line);
      int bar[] = new int[n];
      for(i=0;i<n;i++){
        bar[i] = i + 1;
      }
      
      line = reader.readLine();
      j = Integer.parseInt(line);
      for(i=0;i<j;i++){
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      }
      
      for(i=0;i<n;i++){
        System.out.println(bar[i]);
      }
      
      





		}catch(Exception e){
    }




  
	}
} import java.io.*; io.* java import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util public class Main{
	public static void main(String args[]){
    int a=0,b=0,c=0,i=0,n=0,j=0,m=0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


    try{
      String line = reader.readLine();
      n = Integer.parseInt(line);
      int bar[] = new int[n];
      for(i=0;i<n;i++){
        bar[i] = i + 1;
      }
      
      line = reader.readLine();
      j = Integer.parseInt(line);
      for(i=0;i<j;i++){
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      }
      
      for(i=0;i<n;i++){
        System.out.println(bar[i]);
      }
      
      





		}catch(Exception e){
    }




  
	}
} Main public static void main(String args[]){
    int a=0,b=0,c=0,i=0,n=0,j=0,m=0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


    try{
      String line = reader.readLine();
      n = Integer.parseInt(line);
      int bar[] = new int[n];
      for(i=0;i<n;i++){
        bar[i] = i + 1;
      }
      
      line = reader.readLine();
      j = Integer.parseInt(line);
      for(i=0;i<j;i++){
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      }
      
      for(i=0;i<n;i++){
        System.out.println(bar[i]);
      }
      
      





		}catch(Exception e){
    }




  
	} main {
    int a=0,b=0,c=0,i=0,n=0,j=0,m=0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


    try{
      String line = reader.readLine();
      n = Integer.parseInt(line);
      int bar[] = new int[n];
      for(i=0;i<n;i++){
        bar[i] = i + 1;
      }
      
      line = reader.readLine();
      j = Integer.parseInt(line);
      for(i=0;i<j;i++){
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      }
      
      for(i=0;i<n;i++){
        System.out.println(bar[i]);
      }
      
      





		}catch(Exception e){
    }




  
	} int a=0 a 0 b=0 b 0 c=0 c 0 i=0 i 0 n=0 n 0 j=0 j 0 m=0; m 0 BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) try{
      String line = reader.readLine();
      n = Integer.parseInt(line);
      int bar[] = new int[n];
      for(i=0;i<n;i++){
        bar[i] = i + 1;
      }
      
      line = reader.readLine();
      j = Integer.parseInt(line);
      for(i=0;i<j;i++){
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      }
      
      for(i=0;i<n;i++){
        System.out.println(bar[i]);
      }
      
      





		}catch(Exception e){
    } catch(Exception e){
    } Exception e {
    } {
      String line = reader.readLine();
      n = Integer.parseInt(line);
      int bar[] = new int[n];
      for(i=0;i<n;i++){
        bar[i] = i + 1;
      }
      
      line = reader.readLine();
      j = Integer.parseInt(line);
      for(i=0;i<j;i++){
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      }
      
      for(i=0;i<n;i++){
        System.out.println(bar[i]);
      }
      
      





		} String line = reader.readLine(); line reader.readLine() reader.readLine reader n = Integer.parseInt(line) n Integer.parseInt(line) Integer.parseInt Integer line int bar[] = new int[n]; bar new int[n] n for(i=0;i<n;i++){
        bar[i] = i + 1;
      } i=0; i=0 i 0 i<n i n i++ i++ i {
        bar[i] = i + 1;
      } {
        bar[i] = i + 1;
      } bar[i] = i + 1 bar[i] bar i i + 1 i 1 line = reader.readLine() line reader.readLine() reader.readLine reader j = Integer.parseInt(line) j Integer.parseInt(line) Integer.parseInt Integer line for(i=0;i<j;i++){
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      } i=0; i=0 i 0 i<j i j i++ i++ i {
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      } {
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      } line = reader.readLine() line reader.readLine() reader.readLine reader String[] splitted = line.split(","); splitted line.split(",") line.split line "," a = Integer.parseInt(splitted[0]) a Integer.parseInt(splitted[0]) Integer.parseInt Integer splitted[0] splitted 0 b = Integer.parseInt(splitted[1]) b Integer.parseInt(splitted[1]) Integer.parseInt Integer splitted[1] splitted 1 c = bar[a - 1] c bar[a - 1] bar a - 1 a 1 bar[a - 1] = bar[b - 1] bar[a - 1] bar a - 1 a 1 bar[b - 1] bar b - 1 b 1 bar[b - 1] = c bar[b - 1] bar b - 1 b 1 c for(i=0;i<n;i++){
        System.out.println(bar[i]);
      } i=0; i=0 i 0 i<n i n i++ i++ i {
        System.out.println(bar[i]);
      } {
        System.out.println(bar[i]);
      } System.out.println(bar[i]) System.out.println System.out System System.out bar[i] bar i String args[] args public class Main{
	public static void main(String args[]){
    int a=0,b=0,c=0,i=0,n=0,j=0,m=0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


    try{
      String line = reader.readLine();
      n = Integer.parseInt(line);
      int bar[] = new int[n];
      for(i=0;i<n;i++){
        bar[i] = i + 1;
      }
      
      line = reader.readLine();
      j = Integer.parseInt(line);
      for(i=0;i<j;i++){
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      }
      
      for(i=0;i<n;i++){
        System.out.println(bar[i]);
      }
      
      





		}catch(Exception e){
    }




  
	}
} public class Main{
	public static void main(String args[]){
    int a=0,b=0,c=0,i=0,n=0,j=0,m=0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


    try{
      String line = reader.readLine();
      n = Integer.parseInt(line);
      int bar[] = new int[n];
      for(i=0;i<n;i++){
        bar[i] = i + 1;
      }
      
      line = reader.readLine();
      j = Integer.parseInt(line);
      for(i=0;i<j;i++){
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      }
      
      for(i=0;i<n;i++){
        System.out.println(bar[i]);
      }
      
      





		}catch(Exception e){
    }




  
	}
} Main
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;
public class Main{
	public static void main(String args[]){
    int a=0,b=0,c=0,i=0,n=0,j=0,m=0;
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


    try{
      String line = reader.readLine();
      n = Integer.parseInt(line);
      int bar[] = new int[n];
      for(i=0;i<n;i++){
        bar[i] = i + 1;
      }
      
      line = reader.readLine();
      j = Integer.parseInt(line);
      for(i=0;i<j;i++){
        line = reader.readLine();
        String[] splitted = line.split(",");
        a = Integer.parseInt(splitted[0]);
        b = Integer.parseInt(splitted[1]);
        c = bar[a - 1];
        bar[a - 1] = bar[b - 1];
        bar[b - 1] = c;

      }
      
      for(i=0;i<n;i++){
        System.out.println(bar[i]);
      }
      
      





		}catch(Exception e){
    }




  
	}
}
