import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int VerticalLineNum = Integer.parseInt(br.readLine());
        int HorizontalLineNum = Integer.parseInt(br.readLine());
        int[][] HorizontalLine = new int[HorizontalLineNum][2];
        
        for(int i = 0; i < HorizontalLine.length; i++){
            String[] FromTo = br.readLine().split(",");
            HorizontalLine[i][0] = Integer.parseInt(FromTo[0]);
            HorizontalLine[i][1] = Integer.parseInt(FromTo[1]);
        }
        
        int[] ResultLineNum = new int[VerticalLineNum + 1];
        for(int i = 1; i < VerticalLineNum + 1; i++){
            int CurrentLineNum = i;
            for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            }
            ResultLineNum[CurrentLineNum] = i;
        }
        
        for(int i = 1; i < ResultLineNum.length; i++){
            System.out.println(ResultLineNum[i]);
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int VerticalLineNum = Integer.parseInt(br.readLine());
        int HorizontalLineNum = Integer.parseInt(br.readLine());
        int[][] HorizontalLine = new int[HorizontalLineNum][2];
        
        for(int i = 0; i < HorizontalLine.length; i++){
            String[] FromTo = br.readLine().split(",");
            HorizontalLine[i][0] = Integer.parseInt(FromTo[0]);
            HorizontalLine[i][1] = Integer.parseInt(FromTo[1]);
        }
        
        int[] ResultLineNum = new int[VerticalLineNum + 1];
        for(int i = 1; i < VerticalLineNum + 1; i++){
            int CurrentLineNum = i;
            for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            }
            ResultLineNum[CurrentLineNum] = i;
        }
        
        for(int i = 1; i < ResultLineNum.length; i++){
            System.out.println(ResultLineNum[i]);
        }
    }
} Main public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int VerticalLineNum = Integer.parseInt(br.readLine());
        int HorizontalLineNum = Integer.parseInt(br.readLine());
        int[][] HorizontalLine = new int[HorizontalLineNum][2];
        
        for(int i = 0; i < HorizontalLine.length; i++){
            String[] FromTo = br.readLine().split(",");
            HorizontalLine[i][0] = Integer.parseInt(FromTo[0]);
            HorizontalLine[i][1] = Integer.parseInt(FromTo[1]);
        }
        
        int[] ResultLineNum = new int[VerticalLineNum + 1];
        for(int i = 1; i < VerticalLineNum + 1; i++){
            int CurrentLineNum = i;
            for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            }
            ResultLineNum[CurrentLineNum] = i;
        }
        
        for(int i = 1; i < ResultLineNum.length; i++){
            System.out.println(ResultLineNum[i]);
        }
    } main {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int VerticalLineNum = Integer.parseInt(br.readLine());
        int HorizontalLineNum = Integer.parseInt(br.readLine());
        int[][] HorizontalLine = new int[HorizontalLineNum][2];
        
        for(int i = 0; i < HorizontalLine.length; i++){
            String[] FromTo = br.readLine().split(",");
            HorizontalLine[i][0] = Integer.parseInt(FromTo[0]);
            HorizontalLine[i][1] = Integer.parseInt(FromTo[1]);
        }
        
        int[] ResultLineNum = new int[VerticalLineNum + 1];
        for(int i = 1; i < VerticalLineNum + 1; i++){
            int CurrentLineNum = i;
            for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            }
            ResultLineNum[CurrentLineNum] = i;
        }
        
        for(int i = 1; i < ResultLineNum.length; i++){
            System.out.println(ResultLineNum[i]);
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int VerticalLineNum = Integer.parseInt(br.readLine()); VerticalLineNum Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int HorizontalLineNum = Integer.parseInt(br.readLine()); HorizontalLineNum Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[][] HorizontalLine = new int[HorizontalLineNum][2]; HorizontalLine new int[HorizontalLineNum][2] HorizontalLineNum 2 for(int i = 0; i < HorizontalLine.length; i++){
            String[] FromTo = br.readLine().split(",");
            HorizontalLine[i][0] = Integer.parseInt(FromTo[0]);
            HorizontalLine[i][1] = Integer.parseInt(FromTo[1]);
        } int i = 0; int i = 0; i 0 i < HorizontalLine.length i HorizontalLine.length HorizontalLine HorizontalLine.length i++ i++ i {
            String[] FromTo = br.readLine().split(",");
            HorizontalLine[i][0] = Integer.parseInt(FromTo[0]);
            HorizontalLine[i][1] = Integer.parseInt(FromTo[1]);
        } {
            String[] FromTo = br.readLine().split(",");
            HorizontalLine[i][0] = Integer.parseInt(FromTo[0]);
            HorizontalLine[i][1] = Integer.parseInt(FromTo[1]);
        } String[] FromTo = br.readLine().split(","); FromTo br.readLine().split(",") br.readLine().split br.readLine() br.readLine br "," HorizontalLine[i][0] = Integer.parseInt(FromTo[0]) HorizontalLine[i][0] HorizontalLine[i] HorizontalLine i 0 Integer.parseInt(FromTo[0]) Integer.parseInt Integer FromTo[0] FromTo 0 HorizontalLine[i][1] = Integer.parseInt(FromTo[1]) HorizontalLine[i][1] HorizontalLine[i] HorizontalLine i 1 Integer.parseInt(FromTo[1]) Integer.parseInt Integer FromTo[1] FromTo 1 int[] ResultLineNum = new int[VerticalLineNum + 1]; ResultLineNum new int[VerticalLineNum + 1] VerticalLineNum + 1 VerticalLineNum 1 for(int i = 1; i < VerticalLineNum + 1; i++){
            int CurrentLineNum = i;
            for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            }
            ResultLineNum[CurrentLineNum] = i;
        } int i = 1; int i = 1; i 1 i < VerticalLineNum + 1 i VerticalLineNum + 1 VerticalLineNum 1 i++ i++ i {
            int CurrentLineNum = i;
            for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            }
            ResultLineNum[CurrentLineNum] = i;
        } {
            int CurrentLineNum = i;
            for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            }
            ResultLineNum[CurrentLineNum] = i;
        } int CurrentLineNum = i; CurrentLineNum i for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            } int hl = 0; int hl = 0; hl 0 hl < HorizontalLine.length hl HorizontalLine.length HorizontalLine HorizontalLine.length hl++ hl++ hl {
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            } {
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            } if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                } CurrentLineNum == HorizontalLine[hl][0] CurrentLineNum HorizontalLine[hl][0] HorizontalLine[hl] HorizontalLine hl 0 {
                    CurrentLineNum = HorizontalLine[hl][1];
                } CurrentLineNum = HorizontalLine[hl][1] CurrentLineNum HorizontalLine[hl][1] HorizontalLine[hl] HorizontalLine hl 1 if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                } CurrentLineNum == HorizontalLine[hl][1] CurrentLineNum HorizontalLine[hl][1] HorizontalLine[hl] HorizontalLine hl 1 {
                    CurrentLineNum = HorizontalLine[hl][0];
                } CurrentLineNum = HorizontalLine[hl][0] CurrentLineNum HorizontalLine[hl][0] HorizontalLine[hl] HorizontalLine hl 0 ResultLineNum[CurrentLineNum] = i ResultLineNum[CurrentLineNum] ResultLineNum CurrentLineNum i for(int i = 1; i < ResultLineNum.length; i++){
            System.out.println(ResultLineNum[i]);
        } int i = 1; int i = 1; i 1 i < ResultLineNum.length i ResultLineNum.length ResultLineNum ResultLineNum.length i++ i++ i {
            System.out.println(ResultLineNum[i]);
        } {
            System.out.println(ResultLineNum[i]);
        } System.out.println(ResultLineNum[i]) System.out.println System.out System System.out ResultLineNum[i] ResultLineNum i String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int VerticalLineNum = Integer.parseInt(br.readLine());
        int HorizontalLineNum = Integer.parseInt(br.readLine());
        int[][] HorizontalLine = new int[HorizontalLineNum][2];
        
        for(int i = 0; i < HorizontalLine.length; i++){
            String[] FromTo = br.readLine().split(",");
            HorizontalLine[i][0] = Integer.parseInt(FromTo[0]);
            HorizontalLine[i][1] = Integer.parseInt(FromTo[1]);
        }
        
        int[] ResultLineNum = new int[VerticalLineNum + 1];
        for(int i = 1; i < VerticalLineNum + 1; i++){
            int CurrentLineNum = i;
            for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            }
            ResultLineNum[CurrentLineNum] = i;
        }
        
        for(int i = 1; i < ResultLineNum.length; i++){
            System.out.println(ResultLineNum[i]);
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int VerticalLineNum = Integer.parseInt(br.readLine());
        int HorizontalLineNum = Integer.parseInt(br.readLine());
        int[][] HorizontalLine = new int[HorizontalLineNum][2];
        
        for(int i = 0; i < HorizontalLine.length; i++){
            String[] FromTo = br.readLine().split(",");
            HorizontalLine[i][0] = Integer.parseInt(FromTo[0]);
            HorizontalLine[i][1] = Integer.parseInt(FromTo[1]);
        }
        
        int[] ResultLineNum = new int[VerticalLineNum + 1];
        for(int i = 1; i < VerticalLineNum + 1; i++){
            int CurrentLineNum = i;
            for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            }
            ResultLineNum[CurrentLineNum] = i;
        }
        
        for(int i = 1; i < ResultLineNum.length; i++){
            System.out.println(ResultLineNum[i]);
        }
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int VerticalLineNum = Integer.parseInt(br.readLine());
        int HorizontalLineNum = Integer.parseInt(br.readLine());
        int[][] HorizontalLine = new int[HorizontalLineNum][2];
        
        for(int i = 0; i < HorizontalLine.length; i++){
            String[] FromTo = br.readLine().split(",");
            HorizontalLine[i][0] = Integer.parseInt(FromTo[0]);
            HorizontalLine[i][1] = Integer.parseInt(FromTo[1]);
        }
        
        int[] ResultLineNum = new int[VerticalLineNum + 1];
        for(int i = 1; i < VerticalLineNum + 1; i++){
            int CurrentLineNum = i;
            for(int hl = 0; hl < HorizontalLine.length; hl++){
                if(CurrentLineNum == HorizontalLine[hl][0]){
                    CurrentLineNum = HorizontalLine[hl][1];
                }
                else if(CurrentLineNum == HorizontalLine[hl][1]){
                    CurrentLineNum = HorizontalLine[hl][0];
                }
            }
            ResultLineNum[CurrentLineNum] = i;
        }
        
        for(int i = 1; i < ResultLineNum.length; i++){
            System.out.println(ResultLineNum[i]);
        }
    }
}