import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int w = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());
        List<String> list = new ArrayList<String>();
        for (int j=0; j<w; j++){
            list.add(String.valueOf(j+1));
        }
        for (int i=0; i<n; i++){
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        }
        for (int k=0; k<list.size(); k++){
            System.out.println(list.get(k));
        }
    }
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.List; List java.util import java.util.ArrayList; ArrayList java.util public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int w = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());
        List<String> list = new ArrayList<String>();
        for (int j=0; j<w; j++){
            list.add(String.valueOf(j+1));
        }
        for (int i=0; i<n; i++){
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        }
        for (int k=0; k<list.size(); k++){
            System.out.println(list.get(k));
        }
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int w = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());
        List<String> list = new ArrayList<String>();
        for (int j=0; j<w; j++){
            list.add(String.valueOf(j+1));
        }
        for (int i=0; i<n; i++){
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        }
        for (int k=0; k<list.size(); k++){
            System.out.println(list.get(k));
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int w = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());
        List<String> list = new ArrayList<String>();
        for (int j=0; j<w; j++){
            list.add(String.valueOf(j+1));
        }
        for (int i=0; i<n; i++){
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        }
        for (int k=0; k<list.size(); k++){
            System.out.println(list.get(k));
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int w = Integer.parseInt(br.readLine()); w Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br List<String> list = new ArrayList<String>(); list new ArrayList<String>() for (int j=0; j<w; j++){
            list.add(String.valueOf(j+1));
        } int j=0; int j=0; j 0 j<w j w j++ j++ j {
            list.add(String.valueOf(j+1));
        } {
            list.add(String.valueOf(j+1));
        } list.add(String.valueOf(j+1)) list.add list String.valueOf(j+1) String.valueOf String j+1 j 1 for (int i=0; i<n; i++){
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        } {
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        } String[] yoko = br.readLine().split(","); yoko br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," int ai = Integer.parseInt(yoko[0]); ai Integer.parseInt(yoko[0]) Integer.parseInt Integer yoko[0] yoko 0 int bi = Integer.parseInt(yoko[1]); bi Integer.parseInt(yoko[1]) Integer.parseInt Integer yoko[1] yoko 1 StringBuilder sb = new StringBuilder(); sb new StringBuilder() sb.append(list.get(ai-1)) sb.append sb list.get(ai-1) list.get list ai-1 ai 1 list.set(ai-1, list.get(bi-1)) list.set list ai-1 ai 1 list.get(bi-1) list.get list bi-1 bi 1 list.set(bi-1, sb.toString()) list.set list bi-1 bi 1 sb.toString() sb.toString sb for (int k=0; k<list.size(); k++){
            System.out.println(list.get(k));
        } int k=0; int k=0; k 0 k<list.size() k list.size() list.size list k++ k++ k {
            System.out.println(list.get(k));
        } {
            System.out.println(list.get(k));
        } System.out.println(list.get(k)) System.out.println System.out System System.out list.get(k) list.get list k String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int w = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());
        List<String> list = new ArrayList<String>();
        for (int j=0; j<w; j++){
            list.add(String.valueOf(j+1));
        }
        for (int i=0; i<n; i++){
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        }
        for (int k=0; k<list.size(); k++){
            System.out.println(list.get(k));
        }
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int w = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());
        List<String> list = new ArrayList<String>();
        for (int j=0; j<w; j++){
            list.add(String.valueOf(j+1));
        }
        for (int i=0; i<n; i++){
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        }
        for (int k=0; k<list.size(); k++){
            System.out.println(list.get(k));
        }
    }
} Main
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int w = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());
        List<String> list = new ArrayList<String>();
        for (int j=0; j<w; j++){
            list.add(String.valueOf(j+1));
        }
        for (int i=0; i<n; i++){
            String[] yoko = br.readLine().split(",");
            int ai = Integer.parseInt(yoko[0]);
            int bi = Integer.parseInt(yoko[1]);
            StringBuilder sb = new StringBuilder();
            sb.append(list.get(ai-1));
            list.set(ai-1, list.get(bi-1));
            list.set(bi-1, sb.toString());
        }
        for (int k=0; k<list.size(); k++){
            System.out.println(list.get(k));
        }
    }
}