import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st;
st = new StringTokenizer(br.readLine(), " ");
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
int[] bucket = new int[n];
for (int k = 0; k < n; k++) {
bucket[k] = k+1;
}
int temp;
for (int k = 0; k < m; k++) {
st = new StringTokenizer(br.readLine(), " ");
int i = Integer.parseInt(st.nextToken()) - 1;
int j = Integer.parseInt(st.nextToken()) - 1;
temp = bucket[i];
bucket[i] = bucket[j];
bucket[j] = temp;
}
for (int number : bucket) {
bw.write(number + " ");
}
bw.flush();
}
}