#include<stdio.h>

int main()
{
	int w,n,a,b,x,y;
	scanf("%d",&w);
	scanf("%d",&n);
	int m[30]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30};

	for(x=0;x<n;x++)
	{
		scanf("%d,%d",&a,&b);
		if(m[a-1]<=m[b-1])
		{
			y=m[b-1]-m[a-1];
			m[a-1]+=y;
			m[b-1]-=y;
		}
		else if(m[a-1]>m[b-1])
		{
			y=m[a-1]-m[b-1];
			m[b-1]+=y;
			m[a-1]-=y;
		}
	}

	for(x=0;x<w;x++)
	{
		printf("%d\n",m[x]);
	}
	return 0;
}