#include<stdio.h>
#include<string.h>#include<stdlib.h>int num[10008];//n个人的编号int copy[10008];int n,k,m;int f(int n){ if(n==1) { return 0; } return (f(n-1)+k)%n;}int main(){ while(scanf("%d %d %d",&n,&k,&m),n||k||m) { int i; for(i=0;i<n;i++) { num[i]=i+1; copy[i]=num[i]; } int np=0; for(i=m;i<n;i++) { num[np++]=copy[i]; } for(i=0;i<m-1;i++) { num[np++]=copy[i]; } n=np;//n个人,k循环的约瑟夫问题 printf("%d\n",num[f(n)]); } return 0;}