import java.io.*;
import java.util.*;

public class army_pk {
	public static void main(String[] args) {
		new army_pk().run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	class Soldier {
		int num;
		Soldier next, prev;

		Soldier(int num) {
			this.num = num;
		}
	}

	public void solve() throws IOException {
		int n = nextInt();
		Soldier[] a = new Soldier[n];
		for (int i = 0; i < n; i++) {
			a[i] = new Soldier(i + 1);
		}
		for (int i = 0; i < n - 1; i++) {
			a[i].next = a[i + 1];
		}
		for (int i = 1; i < n; i++) {
			a[i].prev = a[i - 1];
		}
		int m = nextInt();
		Soldier first = a[0];
		for (int i = 0; i < m; i++) {
			Soldier l = a[nextInt() - 1];
			Soldier r = a[nextInt() - 1];
			Soldier prev = l.prev;
			Soldier next = r.next;
			if (first == l)
				first = r;
			l.prev = next;
			r.next = prev;
			if (prev != null)
				if (prev.next == l)
					prev.next = r;
				else
					prev.prev = r;
			if (next != null)
				if (next.prev == r)
					next.prev = l;
				else
					next.next = l;
		}
		Soldier prev = null;
		for (int i = 0; i < n; i++) {
			out.print(first.num);
			if (i < n - 1)
				out.print(' ');
			Soldier t = first;
			if (first.next != prev)
				first = first.next;
			else
				first = first.prev;
			prev = t;
		}
	}

	public void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			br = new BufferedReader(new FileReader("army.in"));
			out = new PrintWriter("army.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}