import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            int w = Integer.parseInt(line);
            ArrayList<Integer> vline = new ArrayList<>();
            for(int i=1 ; i<=w ;i++){
                vline.add(i);
            }
            line = br.readLine();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            }
            for(int i:vline){
                System.out.println(i);
            }
        } catch (Exception e) {
            System.err.println();
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.StringTokenizer; StringTokenizer java.util public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            int w = Integer.parseInt(line);
            ArrayList<Integer> vline = new ArrayList<>();
            for(int i=1 ; i<=w ;i++){
                vline.add(i);
            }
            line = br.readLine();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            }
            for(int i:vline){
                System.out.println(i);
            }
        } catch (Exception e) {
            System.err.println();
        }
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            int w = Integer.parseInt(line);
            ArrayList<Integer> vline = new ArrayList<>();
            for(int i=1 ; i<=w ;i++){
                vline.add(i);
            }
            line = br.readLine();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            }
            for(int i:vline){
                System.out.println(i);
            }
        } catch (Exception e) {
            System.err.println();
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            int w = Integer.parseInt(line);
            ArrayList<Integer> vline = new ArrayList<>();
            for(int i=1 ; i<=w ;i++){
                vline.add(i);
            }
            line = br.readLine();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            }
            for(int i:vline){
                System.out.println(i);
            }
        } catch (Exception e) {
            System.err.println();
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try {
            String line = br.readLine();
            int w = Integer.parseInt(line);
            ArrayList<Integer> vline = new ArrayList<>();
            for(int i=1 ; i<=w ;i++){
                vline.add(i);
            }
            line = br.readLine();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            }
            for(int i:vline){
                System.out.println(i);
            }
        } catch (Exception e) {
            System.err.println();
        } catch (Exception e) {
            System.err.println();
        } Exception e {
            System.err.println();
        } System.err.println() System.err.println System.err System System.err {
            String line = br.readLine();
            int w = Integer.parseInt(line);
            ArrayList<Integer> vline = new ArrayList<>();
            for(int i=1 ; i<=w ;i++){
                vline.add(i);
            }
            line = br.readLine();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            }
            for(int i:vline){
                System.out.println(i);
            }
        } String line = br.readLine(); line br.readLine() br.readLine br int w = Integer.parseInt(line); w Integer.parseInt(line) Integer.parseInt Integer line ArrayList<Integer> vline = new ArrayList<>(); vline new ArrayList<>() for(int i=1 ; i<=w ;i++){
                vline.add(i);
            } int i=1 ; int i=1 ; i 1 i<=w i w i++ i++ i {
                vline.add(i);
            } {
                vline.add(i);
            } vline.add(i) vline.add vline i line = br.readLine() line br.readLine() br.readLine br int n = Integer.parseInt(line); n Integer.parseInt(line) Integer.parseInt Integer line for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            } {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            } line = br.readLine() line br.readLine() br.readLine br StringTokenizer st = new StringTokenizer(line, ","); st new StringTokenizer(line, ",") int vNum1 = Integer.parseInt(st.nextToken()); vNum1 Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int vNum2 = Integer.parseInt(st.nextToken()); vNum2 Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int originalNum1 = vline.get(vNum1 -1); originalNum1 vline.get(vNum1 -1) vline.get vline vNum1 -1 vNum1 1 int originalNum2 = vline.get(vNum2 -1); originalNum2 vline.get(vNum2 -1) vline.get vline vNum2 -1 vNum2 1 vline.set(vNum1 -1,originalNum2) vline.set vline vNum1 -1 vNum1 1 originalNum2 vline.set(vNum2 - 1,originalNum1) vline.set vline vNum2 - 1 vNum2 1 originalNum1 for(int i:vline){
                System.out.println(i);
            } int i vline {
                System.out.println(i);
            } {
                System.out.println(i);
            } System.out.println(i) System.out.println System.out System System.out i String[] args args public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            int w = Integer.parseInt(line);
            ArrayList<Integer> vline = new ArrayList<>();
            for(int i=1 ; i<=w ;i++){
                vline.add(i);
            }
            line = br.readLine();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            }
            for(int i:vline){
                System.out.println(i);
            }
        } catch (Exception e) {
            System.err.println();
        }
    }
} public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            int w = Integer.parseInt(line);
            ArrayList<Integer> vline = new ArrayList<>();
            for(int i=1 ; i<=w ;i++){
                vline.add(i);
            }
            line = br.readLine();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            }
            for(int i:vline){
                System.out.println(i);
            }
        } catch (Exception e) {
            System.err.println();
        }
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            int w = Integer.parseInt(line);
            ArrayList<Integer> vline = new ArrayList<>();
            for(int i=1 ; i<=w ;i++){
                vline.add(i);
            }
            line = br.readLine();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            }
            for(int i:vline){
                System.out.println(i);
            }
        } catch (Exception e) {
            System.err.println();
        }
    }
}