//UVa133 - The Dole Queue
#include<cstdio>
#define maxn 25
using namespace std;
int n, k, m, a[maxn];
//p为初位置,逆时针走t步,d为-1时顺时针走,返回新位置
int go(int p, int d, int t){
while(t--){
do{ p = (p+d+n-1)%n+1; }while(a[p] == 0);
}
return p;
}
int main(){
while(scanf("%d%d%d", &n, &k, &m) == 3 && n){
for(int i = 1; i <= n; i++) a[i] = i;
int left = n;
int x = n, y = 1;
while(left--){
x = go(x, 1, k);
y = go(y, -1, m);
printf("%3d", x); left--;
if(y != x){ printf("%3d", y); left--;}
a[x] = a[y] = 0;
if(left) printf(",");
}
printf("
");
}
return 0;
}
/*
10 4 3
4 8, 9 5, 3 1, 2 6, 10, 7,
*/