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


public class Main {

	public static void main(String[] a){

		int NumberOfColumn = 0;
		int NumberOfBar = 0;
		int[][] arr;
		int[] ans;
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String tmpString;
		try {
			if(null != (tmpString = bf.readLine())){
				NumberOfColumn = Integer.parseInt(tmpString);
			}
			if(null != (tmpString = bf.readLine())){
				NumberOfBar = Integer.parseInt(tmpString);
			}
			arr = new int[NumberOfBar][2];
			for(int i = 0; i < NumberOfBar; i++){
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			}

			ans = new int[NumberOfColumn];
			for(int i = 0; i < NumberOfColumn; i++){
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			}
			for(int i = 0; i < NumberOfColumn; i++){
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			}

		} catch (Exception e) {
			System.err.println("error");
		} finally {
			try {
				bf.close();
			} catch (IOException e) {
			}
		}

	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] a){

		int NumberOfColumn = 0;
		int NumberOfBar = 0;
		int[][] arr;
		int[] ans;
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String tmpString;
		try {
			if(null != (tmpString = bf.readLine())){
				NumberOfColumn = Integer.parseInt(tmpString);
			}
			if(null != (tmpString = bf.readLine())){
				NumberOfBar = Integer.parseInt(tmpString);
			}
			arr = new int[NumberOfBar][2];
			for(int i = 0; i < NumberOfBar; i++){
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			}

			ans = new int[NumberOfColumn];
			for(int i = 0; i < NumberOfColumn; i++){
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			}
			for(int i = 0; i < NumberOfColumn; i++){
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			}

		} catch (Exception e) {
			System.err.println("error");
		} finally {
			try {
				bf.close();
			} catch (IOException e) {
			}
		}

	}

} Main public static void main(String[] a){

		int NumberOfColumn = 0;
		int NumberOfBar = 0;
		int[][] arr;
		int[] ans;
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String tmpString;
		try {
			if(null != (tmpString = bf.readLine())){
				NumberOfColumn = Integer.parseInt(tmpString);
			}
			if(null != (tmpString = bf.readLine())){
				NumberOfBar = Integer.parseInt(tmpString);
			}
			arr = new int[NumberOfBar][2];
			for(int i = 0; i < NumberOfBar; i++){
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			}

			ans = new int[NumberOfColumn];
			for(int i = 0; i < NumberOfColumn; i++){
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			}
			for(int i = 0; i < NumberOfColumn; i++){
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			}

		} catch (Exception e) {
			System.err.println("error");
		} finally {
			try {
				bf.close();
			} catch (IOException e) {
			}
		}

	} main {

		int NumberOfColumn = 0;
		int NumberOfBar = 0;
		int[][] arr;
		int[] ans;
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String tmpString;
		try {
			if(null != (tmpString = bf.readLine())){
				NumberOfColumn = Integer.parseInt(tmpString);
			}
			if(null != (tmpString = bf.readLine())){
				NumberOfBar = Integer.parseInt(tmpString);
			}
			arr = new int[NumberOfBar][2];
			for(int i = 0; i < NumberOfBar; i++){
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			}

			ans = new int[NumberOfColumn];
			for(int i = 0; i < NumberOfColumn; i++){
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			}
			for(int i = 0; i < NumberOfColumn; i++){
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			}

		} catch (Exception e) {
			System.err.println("error");
		} finally {
			try {
				bf.close();
			} catch (IOException e) {
			}
		}

	} int NumberOfColumn = 0; NumberOfColumn 0 int NumberOfBar = 0; NumberOfBar 0 int[][] arr; arr int[] ans; ans BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); bf new BufferedReader(new InputStreamReader(System.in)) String tmpString; tmpString try {
			if(null != (tmpString = bf.readLine())){
				NumberOfColumn = Integer.parseInt(tmpString);
			}
			if(null != (tmpString = bf.readLine())){
				NumberOfBar = Integer.parseInt(tmpString);
			}
			arr = new int[NumberOfBar][2];
			for(int i = 0; i < NumberOfBar; i++){
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			}

			ans = new int[NumberOfColumn];
			for(int i = 0; i < NumberOfColumn; i++){
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			}
			for(int i = 0; i < NumberOfColumn; i++){
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			}

		} catch (Exception e) {
			System.err.println("error");
		} finally {
			try {
				bf.close();
			} catch (IOException e) {
			}
		} catch (Exception e) {
			System.err.println("error");
		} Exception e {
			System.err.println("error");
		} System.err.println("error") System.err.println System.err System System.err "error" {
			try {
				bf.close();
			} catch (IOException e) {
			}
		} try {
				bf.close();
			} catch (IOException e) {
			} catch (IOException e) {
			} IOException e {
			} {
				bf.close();
			} bf.close() bf.close bf {
			if(null != (tmpString = bf.readLine())){
				NumberOfColumn = Integer.parseInt(tmpString);
			}
			if(null != (tmpString = bf.readLine())){
				NumberOfBar = Integer.parseInt(tmpString);
			}
			arr = new int[NumberOfBar][2];
			for(int i = 0; i < NumberOfBar; i++){
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			}

			ans = new int[NumberOfColumn];
			for(int i = 0; i < NumberOfColumn; i++){
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			}
			for(int i = 0; i < NumberOfColumn; i++){
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			}

		} if(null != (tmpString = bf.readLine())){
				NumberOfColumn = Integer.parseInt(tmpString);
			} null != (tmpString = bf.readLine()) null (tmpString = bf.readLine()) tmpString bf.readLine() bf.readLine bf {
				NumberOfColumn = Integer.parseInt(tmpString);
			} NumberOfColumn = Integer.parseInt(tmpString) NumberOfColumn Integer.parseInt(tmpString) Integer.parseInt Integer tmpString if(null != (tmpString = bf.readLine())){
				NumberOfBar = Integer.parseInt(tmpString);
			} null != (tmpString = bf.readLine()) null (tmpString = bf.readLine()) tmpString bf.readLine() bf.readLine bf {
				NumberOfBar = Integer.parseInt(tmpString);
			} NumberOfBar = Integer.parseInt(tmpString) NumberOfBar Integer.parseInt(tmpString) Integer.parseInt Integer tmpString arr = new int[NumberOfBar][2] arr new int[NumberOfBar][2] NumberOfBar 2 for(int i = 0; i < NumberOfBar; i++){
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			} int i = 0; int i = 0; i 0 i < NumberOfBar i NumberOfBar i++ i++ i {
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			} {
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			} if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				} null != (tmpString = bf.readLine()) null (tmpString = bf.readLine()) tmpString bf.readLine() bf.readLine bf {
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				} String[]  tmp = tmpString.split(","); tmp tmpString.split(",") tmpString.split tmpString "," arr[i][0] = Integer.parseInt(tmp[0]) arr[i][0] arr[i] arr i 0 Integer.parseInt(tmp[0]) Integer.parseInt Integer tmp[0] tmp 0 arr[i][1] = Integer.parseInt(tmp[1]) arr[i][1] arr[i] arr i 1 Integer.parseInt(tmp[1]) Integer.parseInt Integer tmp[1] tmp 1 ans = new int[NumberOfColumn] ans new int[NumberOfColumn] NumberOfColumn for(int i = 0; i < NumberOfColumn; i++){
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			} int i = 0; int i = 0; i 0 i < NumberOfColumn i NumberOfColumn i++ i++ i {
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			} {
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			} ans[i] = i + 1 ans[i] ans i i + 1 i 1 for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				} int j = 0; int j = 0; j 0 j < NumberOfBar j NumberOfBar j++ j++ j {
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				} {
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				} if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					} arr[j][0] == ans[i] arr[j][0] arr[j] arr j 0 ans[i] ans i {
						ans[i] = arr[j][1];
					} ans[i] = arr[j][1] ans[i] ans i arr[j][1] arr[j] arr j 1 if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					} arr[j][1] == ans[i] arr[j][1] arr[j] arr j 1 ans[i] ans i {
						ans[i] = arr[j][0];
					} ans[i] = arr[j][0] ans[i] ans i arr[j][0] arr[j] arr j 0 for(int i = 0; i < NumberOfColumn; i++){
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			} int i = 0; int i = 0; i 0 i < NumberOfColumn i NumberOfColumn i++ i++ i {
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			} {
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			} for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				} int j = 0; int j = 0; j 0 j < NumberOfColumn j NumberOfColumn j++ j++ j {
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				} {
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				} if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					} ans[j] == i + 1 ans[j] ans j i + 1 i 1 {
						System.out.println(j + 1);
						break;
					} System.out.println(j + 1) System.out.println System.out System System.out j + 1 j 1 break; String[] a a public class Main {

	public static void main(String[] a){

		int NumberOfColumn = 0;
		int NumberOfBar = 0;
		int[][] arr;
		int[] ans;
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String tmpString;
		try {
			if(null != (tmpString = bf.readLine())){
				NumberOfColumn = Integer.parseInt(tmpString);
			}
			if(null != (tmpString = bf.readLine())){
				NumberOfBar = Integer.parseInt(tmpString);
			}
			arr = new int[NumberOfBar][2];
			for(int i = 0; i < NumberOfBar; i++){
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			}

			ans = new int[NumberOfColumn];
			for(int i = 0; i < NumberOfColumn; i++){
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			}
			for(int i = 0; i < NumberOfColumn; i++){
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			}

		} catch (Exception e) {
			System.err.println("error");
		} finally {
			try {
				bf.close();
			} catch (IOException e) {
			}
		}

	}

} public class Main {

	public static void main(String[] a){

		int NumberOfColumn = 0;
		int NumberOfBar = 0;
		int[][] arr;
		int[] ans;
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String tmpString;
		try {
			if(null != (tmpString = bf.readLine())){
				NumberOfColumn = Integer.parseInt(tmpString);
			}
			if(null != (tmpString = bf.readLine())){
				NumberOfBar = Integer.parseInt(tmpString);
			}
			arr = new int[NumberOfBar][2];
			for(int i = 0; i < NumberOfBar; i++){
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			}

			ans = new int[NumberOfColumn];
			for(int i = 0; i < NumberOfColumn; i++){
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			}
			for(int i = 0; i < NumberOfColumn; i++){
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			}

		} catch (Exception e) {
			System.err.println("error");
		} finally {
			try {
				bf.close();
			} catch (IOException e) {
			}
		}

	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	public static void main(String[] a){

		int NumberOfColumn = 0;
		int NumberOfBar = 0;
		int[][] arr;
		int[] ans;
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String tmpString;
		try {
			if(null != (tmpString = bf.readLine())){
				NumberOfColumn = Integer.parseInt(tmpString);
			}
			if(null != (tmpString = bf.readLine())){
				NumberOfBar = Integer.parseInt(tmpString);
			}
			arr = new int[NumberOfBar][2];
			for(int i = 0; i < NumberOfBar; i++){
				if(null != (tmpString = bf.readLine())){
					String[]  tmp = tmpString.split(",");
					arr[i][0] = Integer.parseInt(tmp[0]);
					arr[i][1] = Integer.parseInt(tmp[1]);
				}
			}

			ans = new int[NumberOfColumn];
			for(int i = 0; i < NumberOfColumn; i++){
				ans[i] = i + 1;
				for(int j = 0; j < NumberOfBar; j++){
					if(arr[j][0] == ans[i]){
						ans[i] = arr[j][1];
					} else if(arr[j][1] == ans[i]){
						ans[i] = arr[j][0];
					}
				}
			}
			for(int i = 0; i < NumberOfColumn; i++){
				for(int j = 0; j < NumberOfColumn; j++ ){
					if(ans[j] == i + 1){
						System.out.println(j + 1);
						break;
					}
				}
			}

		} catch (Exception e) {
			System.err.println("error");
		} finally {
			try {
				bf.close();
			} catch (IOException e) {
			}
		}

	}

}