#include <stdio.h>

int main() {
    int T;
    scanf("%d",&T);
    while(T--) {
        int H, W, N, floor, number, isMulti;
        scanf("%d %d %d",&H, &W, &N);
        isMulti = N%H;
        floor = isMulti ? N%H : H;
        number = isMulti ? N/H + 1 : N/H;
        if(number<10) printf("%d0%d\n",floor,number);
        else printf("%d%d\n",floor,number);
    }

    return 0;
}