import java.util.Scanner;
public class Main{
public static void main(String[] args){
try(Scanner sc = new Scanner(System.in)){
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i = 0; i < values.length; i++){
values[i] = i + 1;
}
sc.useDelimiter(",|\n");
for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
}
for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
}
sc.close();
}
}
} import java.util.Scanner; Scanner java.util public class Main{
public static void main(String[] args){
try(Scanner sc = new Scanner(System.in)){
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i = 0; i < values.length; i++){
values[i] = i + 1;
}
sc.useDelimiter(",|\n");
for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
}
for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
}
sc.close();
}
}
} Main public static void main(String[] args){
try(Scanner sc = new Scanner(System.in)){
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i = 0; i < values.length; i++){
values[i] = i + 1;
}
sc.useDelimiter(",|\n");
for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
}
for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
}
sc.close();
}
} main {
try(Scanner sc = new Scanner(System.in)){
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i = 0; i < values.length; i++){
values[i] = i + 1;
}
sc.useDelimiter(",|\n");
for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
}
for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
}
sc.close();
}
} try(Scanner sc = new Scanner(System.in)){
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i = 0; i < values.length; i++){
values[i] = i + 1;
}
sc.useDelimiter(",|\n");
for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
}
for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
}
sc.close();
} {
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i = 0; i < values.length; i++){
values[i] = i + 1;
}
sc.useDelimiter(",|\n");
for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
}
for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
}
sc.close();
} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] values = new int[w]; values new int[w] w for(int i = 0; i < values.length; i++){
values[i] = i + 1;
} int i = 0; int i = 0; i 0 i < values.length i values.length values values.length i++ i++ i {
values[i] = i + 1;
} {
values[i] = i + 1;
} values[i] = i + 1 values[i] values i i + 1 i 1 sc.useDelimiter(",|\n") sc.useDelimiter sc ",|\n" for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
} {
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int temp = values[a-1]; temp values[a-1] values a-1 a 1 values[a-1] = values[b-1] values[a-1] values a-1 a 1 values[b-1] values b-1 b 1 values[b-1] = temp values[b-1] values b-1 b 1 temp for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
} int i = 0; int i = 0; i 0 i<values.length i values.length values values.length i++ i++ i {
System.out.println(values[i]);
} {
System.out.println(values[i]);
} System.out.println(values[i]) System.out.println System.out System System.out values[i] values i sc.close() sc.close sc String[] args args public class Main{
public static void main(String[] args){
try(Scanner sc = new Scanner(System.in)){
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i = 0; i < values.length; i++){
values[i] = i + 1;
}
sc.useDelimiter(",|\n");
for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
}
for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
}
sc.close();
}
}
} public class Main{
public static void main(String[] args){
try(Scanner sc = new Scanner(System.in)){
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i = 0; i < values.length; i++){
values[i] = i + 1;
}
sc.useDelimiter(",|\n");
for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
}
for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
}
sc.close();
}
}
} Main
import java.util.Scanner;
public class Main{
public static void main(String[] args){
try(Scanner sc = new Scanner(System.in)){
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i = 0; i < values.length; i++){
values[i] = i + 1;
}
sc.useDelimiter(",|\n");
for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
}
for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
}
sc.close();
}
}
}
