import java.io.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str = br.readLine();
		int n = Integer.parseInt(str);
		int m = n;
		int[] amida = new int[n];
		for(int i = 0; i < n; i++)
			amida[i] = i+1;
		str = br.readLine();
		n = Integer.parseInt(str);
		int[][] yoko = new int[n][2];
		
		for(int i = 0; i < n; i++){
			str = br.readLine();
			String str1 = str.substring(0, str.indexOf(","));
			str = str.substring(str.indexOf(",")+1);
			yoko[i][0] = Integer.parseInt(str1);
			yoko[i][1] = Integer.parseInt(str);
		}
		for(int i = 1; i < n+1; i++){
			int c1=0, c2=0;

			for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			}
			int tmp = amida[c1];
			amida[c1] = amida[c2];
			amida[c2] = tmp;
		}
		for(int k = 0; k < m; k++){
			System.out.println(amida[k]);
		}
				
	}

} import java.io.*; io.* java public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str = br.readLine();
		int n = Integer.parseInt(str);
		int m = n;
		int[] amida = new int[n];
		for(int i = 0; i < n; i++)
			amida[i] = i+1;
		str = br.readLine();
		n = Integer.parseInt(str);
		int[][] yoko = new int[n][2];
		
		for(int i = 0; i < n; i++){
			str = br.readLine();
			String str1 = str.substring(0, str.indexOf(","));
			str = str.substring(str.indexOf(",")+1);
			yoko[i][0] = Integer.parseInt(str1);
			yoko[i][1] = Integer.parseInt(str);
		}
		for(int i = 1; i < n+1; i++){
			int c1=0, c2=0;

			for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			}
			int tmp = amida[c1];
			amida[c1] = amida[c2];
			amida[c2] = tmp;
		}
		for(int k = 0; k < m; k++){
			System.out.println(amida[k]);
		}
				
	}

} Main /**
	 * @param args
	 */
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str = br.readLine();
		int n = Integer.parseInt(str);
		int m = n;
		int[] amida = new int[n];
		for(int i = 0; i < n; i++)
			amida[i] = i+1;
		str = br.readLine();
		n = Integer.parseInt(str);
		int[][] yoko = new int[n][2];
		
		for(int i = 0; i < n; i++){
			str = br.readLine();
			String str1 = str.substring(0, str.indexOf(","));
			str = str.substring(str.indexOf(",")+1);
			yoko[i][0] = Integer.parseInt(str1);
			yoko[i][1] = Integer.parseInt(str);
		}
		for(int i = 1; i < n+1; i++){
			int c1=0, c2=0;

			for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			}
			int tmp = amida[c1];
			amida[c1] = amida[c2];
			amida[c2] = tmp;
		}
		for(int k = 0; k < m; k++){
			System.out.println(amida[k]);
		}
				
	} main {
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str = br.readLine();
		int n = Integer.parseInt(str);
		int m = n;
		int[] amida = new int[n];
		for(int i = 0; i < n; i++)
			amida[i] = i+1;
		str = br.readLine();
		n = Integer.parseInt(str);
		int[][] yoko = new int[n][2];
		
		for(int i = 0; i < n; i++){
			str = br.readLine();
			String str1 = str.substring(0, str.indexOf(","));
			str = str.substring(str.indexOf(",")+1);
			yoko[i][0] = Integer.parseInt(str1);
			yoko[i][1] = Integer.parseInt(str);
		}
		for(int i = 1; i < n+1; i++){
			int c1=0, c2=0;

			for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			}
			int tmp = amida[c1];
			amida[c1] = amida[c2];
			amida[c2] = tmp;
		}
		for(int k = 0; k < m; k++){
			System.out.println(amida[k]);
		}
				
	} InputStreamReader is = new InputStreamReader(System.in); is new InputStreamReader(System.in) BufferedReader br = new BufferedReader(is); br new BufferedReader(is) String str = br.readLine(); str br.readLine() br.readLine br int n = Integer.parseInt(str); n Integer.parseInt(str) Integer.parseInt Integer str int m = n; m n int[] amida = new int[n]; amida new int[n] n for(int i = 0; i < n; i++)
			amida[i] = i+1; int i = 0; int i = 0; i 0 i < n i n i++ i++ i amida[i] = i+1; amida[i] = i+1 amida[i] amida i i+1 i 1 str = br.readLine() str br.readLine() br.readLine br n = Integer.parseInt(str) n Integer.parseInt(str) Integer.parseInt Integer str int[][] yoko = new int[n][2]; yoko new int[n][2] n 2 for(int i = 0; i < n; i++){
			str = br.readLine();
			String str1 = str.substring(0, str.indexOf(","));
			str = str.substring(str.indexOf(",")+1);
			yoko[i][0] = Integer.parseInt(str1);
			yoko[i][1] = Integer.parseInt(str);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			str = br.readLine();
			String str1 = str.substring(0, str.indexOf(","));
			str = str.substring(str.indexOf(",")+1);
			yoko[i][0] = Integer.parseInt(str1);
			yoko[i][1] = Integer.parseInt(str);
		} {
			str = br.readLine();
			String str1 = str.substring(0, str.indexOf(","));
			str = str.substring(str.indexOf(",")+1);
			yoko[i][0] = Integer.parseInt(str1);
			yoko[i][1] = Integer.parseInt(str);
		} str = br.readLine() str br.readLine() br.readLine br String str1 = str.substring(0, str.indexOf(",")); str1 str.substring(0, str.indexOf(",")) str.substring str 0 str.indexOf(",") str.indexOf str "," str = str.substring(str.indexOf(",")+1) str str.substring(str.indexOf(",")+1) str.substring str str.indexOf(",")+1 str.indexOf(",") str.indexOf str "," 1 yoko[i][0] = Integer.parseInt(str1) yoko[i][0] yoko[i] yoko i 0 Integer.parseInt(str1) Integer.parseInt Integer str1 yoko[i][1] = Integer.parseInt(str) yoko[i][1] yoko[i] yoko i 1 Integer.parseInt(str) Integer.parseInt Integer str for(int i = 1; i < n+1; i++){
			int c1=0, c2=0;

			for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			}
			int tmp = amida[c1];
			amida[c1] = amida[c2];
			amida[c2] = tmp;
		} int i = 1; int i = 1; i 1 i < n+1 i n+1 n 1 i++ i++ i {
			int c1=0, c2=0;

			for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			}
			int tmp = amida[c1];
			amida[c1] = amida[c2];
			amida[c2] = tmp;
		} {
			int c1=0, c2=0;

			for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			}
			int tmp = amida[c1];
			amida[c1] = amida[c2];
			amida[c2] = tmp;
		} int c1=0 c1 0 c2=0; c2 0 for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			} int j = 0; int j = 0; j 0 j < m j m j++ j++ j {
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			} {
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			} if(amida[j] == yoko[n-i][0] )c1 = j; amida[j] == yoko[n-i][0] amida[j] amida j yoko[n-i][0] yoko[n-i] yoko n-i n i 0 c1 = j c1 j if(amida[j] == yoko[n-i][1] )c2 = j; amida[j] == yoko[n-i][1] amida[j] amida j yoko[n-i][1] yoko[n-i] yoko n-i n i 1 c2 = j c2 j int tmp = amida[c1]; tmp amida[c1] amida c1 amida[c1] = amida[c2] amida[c1] amida c1 amida[c2] amida c2 amida[c2] = tmp amida[c2] amida c2 tmp for(int k = 0; k < m; k++){
			System.out.println(amida[k]);
		} int k = 0; int k = 0; k 0 k < m k m k++ k++ k {
			System.out.println(amida[k]);
		} {
			System.out.println(amida[k]);
		} System.out.println(amida[k]) System.out.println System.out System System.out amida[k] amida k String[] args args public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str = br.readLine();
		int n = Integer.parseInt(str);
		int m = n;
		int[] amida = new int[n];
		for(int i = 0; i < n; i++)
			amida[i] = i+1;
		str = br.readLine();
		n = Integer.parseInt(str);
		int[][] yoko = new int[n][2];
		
		for(int i = 0; i < n; i++){
			str = br.readLine();
			String str1 = str.substring(0, str.indexOf(","));
			str = str.substring(str.indexOf(",")+1);
			yoko[i][0] = Integer.parseInt(str1);
			yoko[i][1] = Integer.parseInt(str);
		}
		for(int i = 1; i < n+1; i++){
			int c1=0, c2=0;

			for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			}
			int tmp = amida[c1];
			amida[c1] = amida[c2];
			amida[c2] = tmp;
		}
		for(int k = 0; k < m; k++){
			System.out.println(amida[k]);
		}
				
	}

} public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str = br.readLine();
		int n = Integer.parseInt(str);
		int m = n;
		int[] amida = new int[n];
		for(int i = 0; i < n; i++)
			amida[i] = i+1;
		str = br.readLine();
		n = Integer.parseInt(str);
		int[][] yoko = new int[n][2];
		
		for(int i = 0; i < n; i++){
			str = br.readLine();
			String str1 = str.substring(0, str.indexOf(","));
			str = str.substring(str.indexOf(",")+1);
			yoko[i][0] = Integer.parseInt(str1);
			yoko[i][1] = Integer.parseInt(str);
		}
		for(int i = 1; i < n+1; i++){
			int c1=0, c2=0;

			for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			}
			int tmp = amida[c1];
			amida[c1] = amida[c2];
			amida[c2] = tmp;
		}
		for(int k = 0; k < m; k++){
			System.out.println(amida[k]);
		}
				
	}

} Main
import java.io.*;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str = br.readLine();
		int n = Integer.parseInt(str);
		int m = n;
		int[] amida = new int[n];
		for(int i = 0; i < n; i++)
			amida[i] = i+1;
		str = br.readLine();
		n = Integer.parseInt(str);
		int[][] yoko = new int[n][2];
		
		for(int i = 0; i < n; i++){
			str = br.readLine();
			String str1 = str.substring(0, str.indexOf(","));
			str = str.substring(str.indexOf(",")+1);
			yoko[i][0] = Integer.parseInt(str1);
			yoko[i][1] = Integer.parseInt(str);
		}
		for(int i = 1; i < n+1; i++){
			int c1=0, c2=0;

			for(int j = 0; j < m; j++){
				if(amida[j] == yoko[n-i][0] )c1 = j;
				if(amida[j] == yoko[n-i][1] )c2 = j;
			}
			int tmp = amida[c1];
			amida[c1] = amida[c2];
			amida[c2] = tmp;
		}
		for(int k = 0; k < m; k++){
			System.out.println(amida[k]);
		}
				
	}

}