#!/usr/bin/node
// Generated by CoffeeScript 1.3.3 (minified manually)
(function() {
	var a=[],stdin;
	stdin=process.openStdin();
	stdin.setEncoding('utf8');

	var input_fragment="";
	stdin.on('data', function(input) {
			var ref=(input_fragment+input).split("\n");
			input_fragment=ref.pop();
			for(var i=0;i<ref.length;i++){
				if(ref[i]=='')continue;
				a.push(ref[i]);
			}
	});

	stdin.on('end', function(z) {
		if(input_fragment){
			var ref=(input_fragment+"\n").split("\n");
			input_fragment=ref.pop();
			for(var i=0;i<ref.length;i++){
				if(ref[i]=='')continue;
				a.push(ref[i]);
			}
		}
		a.pop()
		for(var _i=0;_i<a.length;_i++){
			var b = a[_i].split(" ");
			for(var j=0;j<b.length;j++)b[j]=parseInt(b[j]);
			var n=b[0];
			var k=b[1];
			var m=b[2];
			var r=0,i=0;
			for(;++i<n;r%=i)r+=k;
			console.log((r+m)%n+1);
		}
	});
})();