/*   @JUDGE_ID:   1705PZ   133   C */
#include <stdio.h>
#include <stdlib.h>

int empty(int *table,int n){
int i,count = 0;
for(i = 0;i < n;i++)
	count += *(table + i);
if(count == 0)
	return 1;
else
	return 0;
}

int main(){
int pointk,pointm,countk,countm;
int i,n,k,m;
int *table;
while(1){
	pointk = -1;
	pointm = 0;
	scanf("%d %d %d",&n,&k,&m);
	if(n == 0 && k == 0 && m == 0)
		break;
	table = (int *)malloc(sizeof(int) * n);
	for(i = 0;i < n;i++)
		*(table + i) = 1;
	while(1){
		countk = 0;
		countm = 0;
		while(countk != k){
			pointk++;
			pointk %= n;
			if(*(table + pointk) == 1)
				countk++;
			}
		while(countm != m){
			pointm--;
			if(pointm < 0)
				pointm += n;
			if(*(table + pointm) == 1)
				countm++;
			}
		*(table + pointk) = 0;
		*(table + pointm) = 0;
		printf("%3d",pointk + 1);
		if(pointk != pointm)
			printf("%3d",pointm + 1);
		if(empty(table,n) != 1)
			printf(",");
		else{
			printf("\n");
			break;
			}
		}
	free(table);
	}
return 0;
}
@END_OF_SOURCE_CODE
