const n = require("fs").readFileSync(0,"utf8").toString().trim().split('\n');
for(let i=1; i<=Number(n[0]); i++) {
    let [H, W, N] = n[i].split(' ').map(Number);
    const floor = N%H==0 ? H : N%H;
    const number = N%H==0 ? Math.floor(N/H) : Math.floor(N/H) + 1;
    console.log(`${floor}${number<10 ? '0' : ''}${number}`);
}