
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String readStr;
    
    int numOfVertialLine = Integer.parseInt(reader.readLine());
    int[] verticalLines = new int[numOfVertialLine];
    for (int i = 1; i <= verticalLines.length; i++)
      verticalLines[i-1] = i;
    
    int numOfChange = Integer.parseInt(reader.readLine());
    for (int i = 0; i < numOfChange; i++) {
      String[] changeStr = reader.readLine().split(",");
      int from = Integer.parseInt(changeStr[0]);
      int to = Integer.parseInt(changeStr[1]);
      int from_stack = verticalLines[from-1];
      verticalLines[from-1] = verticalLines[to-1];
      verticalLines[to-1] = from_stack;
    }
    
    for (int n : verticalLines)
      System.out.println(n);
    
  }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util public class Main {

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String readStr;
    
    int numOfVertialLine = Integer.parseInt(reader.readLine());
    int[] verticalLines = new int[numOfVertialLine];
    for (int i = 1; i <= verticalLines.length; i++)
      verticalLines[i-1] = i;
    
    int numOfChange = Integer.parseInt(reader.readLine());
    for (int i = 0; i < numOfChange; i++) {
      String[] changeStr = reader.readLine().split(",");
      int from = Integer.parseInt(changeStr[0]);
      int to = Integer.parseInt(changeStr[1]);
      int from_stack = verticalLines[from-1];
      verticalLines[from-1] = verticalLines[to-1];
      verticalLines[to-1] = from_stack;
    }
    
    for (int n : verticalLines)
      System.out.println(n);
    
  }

} Main public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String readStr;
    
    int numOfVertialLine = Integer.parseInt(reader.readLine());
    int[] verticalLines = new int[numOfVertialLine];
    for (int i = 1; i <= verticalLines.length; i++)
      verticalLines[i-1] = i;
    
    int numOfChange = Integer.parseInt(reader.readLine());
    for (int i = 0; i < numOfChange; i++) {
      String[] changeStr = reader.readLine().split(",");
      int from = Integer.parseInt(changeStr[0]);
      int to = Integer.parseInt(changeStr[1]);
      int from_stack = verticalLines[from-1];
      verticalLines[from-1] = verticalLines[to-1];
      verticalLines[to-1] = from_stack;
    }
    
    for (int n : verticalLines)
      System.out.println(n);
    
  } main {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String readStr;
    
    int numOfVertialLine = Integer.parseInt(reader.readLine());
    int[] verticalLines = new int[numOfVertialLine];
    for (int i = 1; i <= verticalLines.length; i++)
      verticalLines[i-1] = i;
    
    int numOfChange = Integer.parseInt(reader.readLine());
    for (int i = 0; i < numOfChange; i++) {
      String[] changeStr = reader.readLine().split(",");
      int from = Integer.parseInt(changeStr[0]);
      int to = Integer.parseInt(changeStr[1]);
      int from_stack = verticalLines[from-1];
      verticalLines[from-1] = verticalLines[to-1];
      verticalLines[to-1] = from_stack;
    }
    
    for (int n : verticalLines)
      System.out.println(n);
    
  } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String readStr; readStr int numOfVertialLine = Integer.parseInt(reader.readLine()); numOfVertialLine Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int[] verticalLines = new int[numOfVertialLine]; verticalLines new int[numOfVertialLine] numOfVertialLine for (int i = 1; i <= verticalLines.length; i++)
      verticalLines[i-1] = i; int i = 1; int i = 1; i 1 i <= verticalLines.length i verticalLines.length verticalLines verticalLines.length i++ i++ i verticalLines[i-1] = i; verticalLines[i-1] = i verticalLines[i-1] verticalLines i-1 i 1 i int numOfChange = Integer.parseInt(reader.readLine()); numOfChange Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader for (int i = 0; i < numOfChange; i++) {
      String[] changeStr = reader.readLine().split(",");
      int from = Integer.parseInt(changeStr[0]);
      int to = Integer.parseInt(changeStr[1]);
      int from_stack = verticalLines[from-1];
      verticalLines[from-1] = verticalLines[to-1];
      verticalLines[to-1] = from_stack;
    } int i = 0; int i = 0; i 0 i < numOfChange i numOfChange i++ i++ i {
      String[] changeStr = reader.readLine().split(",");
      int from = Integer.parseInt(changeStr[0]);
      int to = Integer.parseInt(changeStr[1]);
      int from_stack = verticalLines[from-1];
      verticalLines[from-1] = verticalLines[to-1];
      verticalLines[to-1] = from_stack;
    } {
      String[] changeStr = reader.readLine().split(",");
      int from = Integer.parseInt(changeStr[0]);
      int to = Integer.parseInt(changeStr[1]);
      int from_stack = verticalLines[from-1];
      verticalLines[from-1] = verticalLines[to-1];
      verticalLines[to-1] = from_stack;
    } String[] changeStr = reader.readLine().split(","); changeStr reader.readLine().split(",") reader.readLine().split reader.readLine() reader.readLine reader "," int from = Integer.parseInt(changeStr[0]); from Integer.parseInt(changeStr[0]) Integer.parseInt Integer changeStr[0] changeStr 0 int to = Integer.parseInt(changeStr[1]); to Integer.parseInt(changeStr[1]) Integer.parseInt Integer changeStr[1] changeStr 1 int from_stack = verticalLines[from-1]; from_stack verticalLines[from-1] verticalLines from-1 from 1 verticalLines[from-1] = verticalLines[to-1] verticalLines[from-1] verticalLines from-1 from 1 verticalLines[to-1] verticalLines to-1 to 1 verticalLines[to-1] = from_stack verticalLines[to-1] verticalLines to-1 to 1 from_stack for (int n : verticalLines)
      System.out.println(n); int n verticalLines System.out.println(n); System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main {

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String readStr;
    
    int numOfVertialLine = Integer.parseInt(reader.readLine());
    int[] verticalLines = new int[numOfVertialLine];
    for (int i = 1; i <= verticalLines.length; i++)
      verticalLines[i-1] = i;
    
    int numOfChange = Integer.parseInt(reader.readLine());
    for (int i = 0; i < numOfChange; i++) {
      String[] changeStr = reader.readLine().split(",");
      int from = Integer.parseInt(changeStr[0]);
      int to = Integer.parseInt(changeStr[1]);
      int from_stack = verticalLines[from-1];
      verticalLines[from-1] = verticalLines[to-1];
      verticalLines[to-1] = from_stack;
    }
    
    for (int n : verticalLines)
      System.out.println(n);
    
  }

} public class Main {

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String readStr;
    
    int numOfVertialLine = Integer.parseInt(reader.readLine());
    int[] verticalLines = new int[numOfVertialLine];
    for (int i = 1; i <= verticalLines.length; i++)
      verticalLines[i-1] = i;
    
    int numOfChange = Integer.parseInt(reader.readLine());
    for (int i = 0; i < numOfChange; i++) {
      String[] changeStr = reader.readLine().split(",");
      int from = Integer.parseInt(changeStr[0]);
      int to = Integer.parseInt(changeStr[1]);
      int from_stack = verticalLines[from-1];
      verticalLines[from-1] = verticalLines[to-1];
      verticalLines[to-1] = from_stack;
    }
    
    for (int n : verticalLines)
      System.out.println(n);
    
  }

} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String readStr;
    
    int numOfVertialLine = Integer.parseInt(reader.readLine());
    int[] verticalLines = new int[numOfVertialLine];
    for (int i = 1; i <= verticalLines.length; i++)
      verticalLines[i-1] = i;
    
    int numOfChange = Integer.parseInt(reader.readLine());
    for (int i = 0; i < numOfChange; i++) {
      String[] changeStr = reader.readLine().split(",");
      int from = Integer.parseInt(changeStr[0]);
      int to = Integer.parseInt(changeStr[1]);
      int from_stack = verticalLines[from-1];
      verticalLines[from-1] = verticalLines[to-1];
      verticalLines[to-1] = from_stack;
    }
    
    for (int n : verticalLines)
      System.out.println(n);
    
  }

}