import java.util.Scanner;


public class Main 
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		
		int[] m = new int[w];
		for(int i=0; i<w; i++)
		{
			m[i] = i+1;
		}
		
		for(int i=0; i<n; i++)
		{	
			String s = scanner.next();
			String[] str = s.split(",");
			
			int a = Integer.parseInt(str[0]) -1;
			int b = Integer.parseInt(str[1]) -1;
			
			int buf = m[a];
			m[a] = m[b];
			m[b] = buf;
		}
		
		for(int i=0; i<w; i++)
		{
			System.out.println(m[i]);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main 
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		
		int[] m = new int[w];
		for(int i=0; i<w; i++)
		{
			m[i] = i+1;
		}
		
		for(int i=0; i<n; i++)
		{	
			String s = scanner.next();
			String[] str = s.split(",");
			
			int a = Integer.parseInt(str[0]) -1;
			int b = Integer.parseInt(str[1]) -1;
			
			int buf = m[a];
			m[a] = m[b];
			m[b] = buf;
		}
		
		for(int i=0; i<w; i++)
		{
			System.out.println(m[i]);
		}
	}
} Main public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		
		int[] m = new int[w];
		for(int i=0; i<w; i++)
		{
			m[i] = i+1;
		}
		
		for(int i=0; i<n; i++)
		{	
			String s = scanner.next();
			String[] str = s.split(",");
			
			int a = Integer.parseInt(str[0]) -1;
			int b = Integer.parseInt(str[1]) -1;
			
			int buf = m[a];
			m[a] = m[b];
			m[b] = buf;
		}
		
		for(int i=0; i<w; i++)
		{
			System.out.println(m[i]);
		}
	} main {
		Scanner scanner = new Scanner(System.in);
		
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		
		int[] m = new int[w];
		for(int i=0; i<w; i++)
		{
			m[i] = i+1;
		}
		
		for(int i=0; i<n; i++)
		{	
			String s = scanner.next();
			String[] str = s.split(",");
			
			int a = Integer.parseInt(str[0]) -1;
			int b = Integer.parseInt(str[1]) -1;
			
			int buf = m[a];
			m[a] = m[b];
			m[b] = buf;
		}
		
		for(int i=0; i<w; i++)
		{
			System.out.println(m[i]);
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int w = scanner.nextInt(); w scanner.nextInt() scanner.nextInt scanner int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] m = new int[w]; m new int[w] w for(int i=0; i<w; i++)
		{
			m[i] = i+1;
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			m[i] = i+1;
		} {
			m[i] = i+1;
		} m[i] = i+1 m[i] m i i+1 i 1 for(int i=0; i<n; i++)
		{	
			String s = scanner.next();
			String[] str = s.split(",");
			
			int a = Integer.parseInt(str[0]) -1;
			int b = Integer.parseInt(str[1]) -1;
			
			int buf = m[a];
			m[a] = m[b];
			m[b] = buf;
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {	
			String s = scanner.next();
			String[] str = s.split(",");
			
			int a = Integer.parseInt(str[0]) -1;
			int b = Integer.parseInt(str[1]) -1;
			
			int buf = m[a];
			m[a] = m[b];
			m[b] = buf;
		} {	
			String s = scanner.next();
			String[] str = s.split(",");
			
			int a = Integer.parseInt(str[0]) -1;
			int b = Integer.parseInt(str[1]) -1;
			
			int buf = m[a];
			m[a] = m[b];
			m[b] = buf;
		} String s = scanner.next(); s scanner.next() scanner.next scanner String[] str = s.split(","); str s.split(",") s.split s "," int a = Integer.parseInt(str[0]) -1; a Integer.parseInt(str[0]) -1 Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 1 int b = Integer.parseInt(str[1]) -1; b Integer.parseInt(str[1]) -1 Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 1 int buf = m[a]; buf m[a] m a m[a] = m[b] m[a] m a m[b] m b m[b] = buf m[b] m b buf for(int i=0; i<w; i++)
		{
			System.out.println(m[i]);
		} int i=0; int i=0; i 0 i<w i w i++ i++ i {
			System.out.println(m[i]);
		} {
			System.out.println(m[i]);
		} System.out.println(m[i]) System.out.println System.out System System.out m[i] m i String[] args args public class Main 
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		
		int[] m = new int[w];
		for(int i=0; i<w; i++)
		{
			m[i] = i+1;
		}
		
		for(int i=0; i<n; i++)
		{	
			String s = scanner.next();
			String[] str = s.split(",");
			
			int a = Integer.parseInt(str[0]) -1;
			int b = Integer.parseInt(str[1]) -1;
			
			int buf = m[a];
			m[a] = m[b];
			m[b] = buf;
		}
		
		for(int i=0; i<w; i++)
		{
			System.out.println(m[i]);
		}
	}
} public class Main 
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		
		int[] m = new int[w];
		for(int i=0; i<w; i++)
		{
			m[i] = i+1;
		}
		
		for(int i=0; i<n; i++)
		{	
			String s = scanner.next();
			String[] str = s.split(",");
			
			int a = Integer.parseInt(str[0]) -1;
			int b = Integer.parseInt(str[1]) -1;
			
			int buf = m[a];
			m[a] = m[b];
			m[b] = buf;
		}
		
		for(int i=0; i<w; i++)
		{
			System.out.println(m[i]);
		}
	}
} Main
import java.util.Scanner;


public class Main 
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		int w = scanner.nextInt();
		int n = scanner.nextInt();
		
		int[] m = new int[w];
		for(int i=0; i<w; i++)
		{
			m[i] = i+1;
		}
		
		for(int i=0; i<n; i++)
		{	
			String s = scanner.next();
			String[] str = s.split(",");
			
			int a = Integer.parseInt(str[0]) -1;
			int b = Integer.parseInt(str[1]) -1;
			
			int buf = m[a];
			m[a] = m[b];
			m[b] = buf;
		}
		
		for(int i=0; i<w; i++)
		{
			System.out.println(m[i]);
		}
	}
}