import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  int[] num = new int[in.nextInt()];
  for (int i = 0; i < num.length; i++) {
	num[i] = i + 1;
  }
  int count = in.nextInt();
  Pattern pt = Pattern.compile("(\\d+),(\\d+)");
  int line[] = new int[2];
  for (int i = 0; i < count; i++) {
	String next = in.next(pt);
	for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	}
	int change = num[line[0]];
	num[line[0]] = num[line[1]];
	num[line[1]] = change;
  }
  for (int i = 0; i < num.length; i++) {
	System.out.println(num[i]);
  }
}
} import java.util.Scanner; Scanner java.util import java.util.regex.Matcher; Matcher java.util.regex import java.util.regex.Pattern; Pattern java.util.regex public class Main {
public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  int[] num = new int[in.nextInt()];
  for (int i = 0; i < num.length; i++) {
	num[i] = i + 1;
  }
  int count = in.nextInt();
  Pattern pt = Pattern.compile("(\\d+),(\\d+)");
  int line[] = new int[2];
  for (int i = 0; i < count; i++) {
	String next = in.next(pt);
	for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	}
	int change = num[line[0]];
	num[line[0]] = num[line[1]];
	num[line[1]] = change;
  }
  for (int i = 0; i < num.length; i++) {
	System.out.println(num[i]);
  }
}
} Main public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  int[] num = new int[in.nextInt()];
  for (int i = 0; i < num.length; i++) {
	num[i] = i + 1;
  }
  int count = in.nextInt();
  Pattern pt = Pattern.compile("(\\d+),(\\d+)");
  int line[] = new int[2];
  for (int i = 0; i < count; i++) {
	String next = in.next(pt);
	for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	}
	int change = num[line[0]];
	num[line[0]] = num[line[1]];
	num[line[1]] = change;
  }
  for (int i = 0; i < num.length; i++) {
	System.out.println(num[i]);
  }
} main {
  Scanner in = new Scanner(System.in);
  int[] num = new int[in.nextInt()];
  for (int i = 0; i < num.length; i++) {
	num[i] = i + 1;
  }
  int count = in.nextInt();
  Pattern pt = Pattern.compile("(\\d+),(\\d+)");
  int line[] = new int[2];
  for (int i = 0; i < count; i++) {
	String next = in.next(pt);
	for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	}
	int change = num[line[0]];
	num[line[0]] = num[line[1]];
	num[line[1]] = change;
  }
  for (int i = 0; i < num.length; i++) {
	System.out.println(num[i]);
  }
} Scanner in = new Scanner(System.in); in new Scanner(System.in) int[] num = new int[in.nextInt()]; num new int[in.nextInt()] in.nextInt() in.nextInt in for (int i = 0; i < num.length; i++) {
	num[i] = i + 1;
  } int i = 0; int i = 0; i 0 i < num.length i num.length num num.length i++ i++ i {
	num[i] = i + 1;
  } {
	num[i] = i + 1;
  } num[i] = i + 1 num[i] num i i + 1 i 1 int count = in.nextInt(); count in.nextInt() in.nextInt in Pattern pt = Pattern.compile("(\\d+),(\\d+)"); pt Pattern.compile("(\\d+),(\\d+)") Pattern.compile Pattern "(\\d+),(\\d+)" int line[] = new int[2]; line new int[2] 2 for (int i = 0; i < count; i++) {
	String next = in.next(pt);
	for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	}
	int change = num[line[0]];
	num[line[0]] = num[line[1]];
	num[line[1]] = change;
  } int i = 0; int i = 0; i 0 i < count i count i++ i++ i {
	String next = in.next(pt);
	for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	}
	int change = num[line[0]];
	num[line[0]] = num[line[1]];
	num[line[1]] = change;
  } {
	String next = in.next(pt);
	for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	}
	int change = num[line[0]];
	num[line[0]] = num[line[1]];
	num[line[1]] = change;
  } String next = in.next(pt); next in.next(pt) in.next in pt for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	} int j = 0; int j = 0; j 0 j < line.length j line.length line line.length j++ j++ j {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	} {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	} Matcher matcher = pt.matcher(next); matcher pt.matcher(next) pt.matcher pt next matcher.matches() matcher.matches matcher line[j] = Integer.parseInt(matcher.group(j + 1)) - 1 line[j] line j Integer.parseInt(matcher.group(j + 1)) - 1 Integer.parseInt(matcher.group(j + 1)) Integer.parseInt Integer matcher.group(j + 1) matcher.group matcher j + 1 j 1 1 int change = num[line[0]]; change num[line[0]] num line[0] line 0 num[line[0]] = num[line[1]] num[line[0]] num line[0] line 0 num[line[1]] num line[1] line 1 num[line[1]] = change num[line[1]] num line[1] line 1 change for (int i = 0; i < num.length; i++) {
	System.out.println(num[i]);
  } int i = 0; int i = 0; i 0 i < num.length i num.length num num.length i++ i++ i {
	System.out.println(num[i]);
  } {
	System.out.println(num[i]);
  } System.out.println(num[i]) System.out.println System.out System System.out num[i] num i String[] args args public class Main {
public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  int[] num = new int[in.nextInt()];
  for (int i = 0; i < num.length; i++) {
	num[i] = i + 1;
  }
  int count = in.nextInt();
  Pattern pt = Pattern.compile("(\\d+),(\\d+)");
  int line[] = new int[2];
  for (int i = 0; i < count; i++) {
	String next = in.next(pt);
	for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	}
	int change = num[line[0]];
	num[line[0]] = num[line[1]];
	num[line[1]] = change;
  }
  for (int i = 0; i < num.length; i++) {
	System.out.println(num[i]);
  }
}
} public class Main {
public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  int[] num = new int[in.nextInt()];
  for (int i = 0; i < num.length; i++) {
	num[i] = i + 1;
  }
  int count = in.nextInt();
  Pattern pt = Pattern.compile("(\\d+),(\\d+)");
  int line[] = new int[2];
  for (int i = 0; i < count; i++) {
	String next = in.next(pt);
	for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	}
	int change = num[line[0]];
	num[line[0]] = num[line[1]];
	num[line[1]] = change;
  }
  for (int i = 0; i < num.length; i++) {
	System.out.println(num[i]);
  }
}
} Main
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  int[] num = new int[in.nextInt()];
  for (int i = 0; i < num.length; i++) {
	num[i] = i + 1;
  }
  int count = in.nextInt();
  Pattern pt = Pattern.compile("(\\d+),(\\d+)");
  int line[] = new int[2];
  for (int i = 0; i < count; i++) {
	String next = in.next(pt);
	for (int j = 0; j < line.length; j++) {
	  Matcher matcher = pt.matcher(next);
	  matcher.matches();
	  line[j] = Integer.parseInt(matcher.group(j + 1)) - 1;
	}
	int change = num[line[0]];
	num[line[0]] = num[line[1]];
	num[line[1]] = change;
  }
  for (int i = 0; i < num.length; i++) {
	System.out.println(num[i]);
  }
}
}