import java.util.ArrayList;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();

        int[] hunters = new int[N];
        int[] positions = new int[N];
        for (int i = 0; i < N; ++i) {
            hunters[i] = i + 1;
            positions[i] = i + 1;
        }
        for (int i = 0; i < M; ++i) {
           int x1, y1, x2, y2;
           x1 = sc.nextInt();
           y1 = sc.nextInt() - 1;
           x2 = sc.nextInt();
           y2 = sc.nextInt() - 1;
           int pos1, pos2;
           pos1 = hunters[x1 -1];
           pos2 = hunters[x2 -1];
           hunters[x1 - 1] = pos2;
           hunters[x2 - 1] = pos1;
        }

        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; j++) {
                if (hunters[j] == i + 1) {
                    System.out.println(j + 1);
                    break;

                }
            }
        }
    }
}
