#include<iostream>
#include<stdio.h>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<string.h>
#include<iomanip>
#include<vector>
#include<utility>
#include<map>
#include<set>
#include<bitset>
#include<iterator>
#include<list>
#include<array>
#include<unordered_map>
//#include "MATH_A.h"
//https://atcoder.jp/contests/dp for DP algorthim

#if 1
#define rep(q,w) for(q=0;q<w;q++)
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define vi vector<int>
#define vs vector<string>
#define vc vector<char>
#define lc list<char>
#define ls list<string>
#define li list<int>
#define pb push_back
#define popb pop_back
#define fastio std::ios_base::sync_with_stdio(false), std::cout.tie(0), std::cin.tie(0);
#define all(v) (v.begin(),v.end())
#define sz(v) (v.size()) 
#define srtR (v.begin(), v.end(),std::greater<int>());
#define srt (v.begin(), v.end());
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
/*
=================================
|                               |
|      WE ARE <  > team         |
|                               |
|  learn more,more and more     |
|                               |
=================================
*/
const double pi = 3.14159265359;
const int MOD = 1000000007;
const int dr[4] = { -1 , 1 , 0 , 0 };
const int dc[4] = { 0 , 0 , -1 , 1 };
//namespace mathA {
double sinA(double dig) {
    return sin(dig * pi / 180);
}double cosA(double dig) {
    return cos(dig * pi / 180);
}double tanA(double dig) {
    int we = dig;
    if (we == dig) {
        if (we % 90 == 0) {
            if ((we / 90) % 2 == 1)std::cout << "ERROR\n";
            else return 0;
        }
    }
    return tan(dig * pi / 180);
}
double secA(double dig) {
    int qw = cos(dig * pi / 180);
    if (qw == 0)std::cout << "ERROR\n";
    else return (1 / qw);
}
double cosecA(double dig) {
    int qw = sin(dig * pi / 180);
    if (qw == 0)std::cout << "ERROR\n";
    else return (1 / qw);
}
double cotA(double dig) {
    int qw = tan(dig * pi / 180);
    if (qw == 0)std::cout << "ERROR\n";
    else return (1 / qw);
}
bool isPrime(long long num) {
    if (num < 0)num *= -1;
    if (num == 1 || num == 0)return false;
    else if (num == 2)return true;
    else {
        if (num % 2 == 0) { return false; }
        else
            for (int x = 3; x <= sqrt(num); x += 2) {
                if (num % x == 0) {
                    return false;
                }
            }
        return true;
    }
}
long long gcd(long long A, long long B) {
    if (B == 0) return A;
    return gcd(B, A % B);
}

long long lcm(long long f, long long l) {
    //if (f < 0)f *= -1;
    //if (l < 0)l *= -1;
    return (f / gcd(f, l) * l);
}
ll fact(ll number) {
    if (number < 0)number *= -1;
    if (number == 0)return 1;
    if (number == 1)return number;
    else return number * fact(number - 1);

}
ll fib(ll n) {
    auto sqrt_5 = std::sqrt(5);
    if (n == 0)return 0;
    if (n == 1)return 1;
    //binet's fibonacci number formula
    return static_cast<ll>((std::pow(1 + sqrt_5, n) - std::pow(1 - sqrt_5, n)) / (std::pow(2, n) * sqrt_5));
}
ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a / b - ((a ^ b) < 0 && a % b); } // divide a by b rounded down

int power(int x, int n) {
    if (n == 0)return 1;
    //if (n == 1)return x;
    int temp = power(x, n / 2);
    temp *= temp;
    if (n % 2)temp *= x;
    return temp;
}
ll powerMOD(ll x, ll n,ll m) {
    if (n == 0)return (1);
    //if (n == 1)return x;
    ll temp = powerMOD(x, n / 2,m);
    temp = ((temp%m)*(temp%m))%m;
    if (n % 2)temp = ((temp % m) * (x % m)) % m;
    return temp;
}
int ETF(int n) {
    int ans = 1;
    for (int x = 2; x * x <= n; x++) {
        if (n % x == 0) {
            int count = 0;
            while (n%x==0) {
                count++;
                n /= x;
            }
            ans *= (power(x, count - 1) * (x - 1));
        }
    }
    if(n!=1)ans *= (n - 1);
    return ans;
}
ll SUM(ll number) {
    ll ans = 0;
    while (number) {
        ans += number % 10;
        number /= 10;
    }
    return ans;
}


std::map<ll, ll> f;
ll fibb(ll n)
{
    if (f.count(n)) return f[n];
    if (n == 0) return 0;
    if (n == 1 || n == 2) return 1;
    if (n % 2 == 0)
    {
        ll k = n / 2;
        ll ret1 = fibb(k - 1), ret2 = fibb(k);
        return f[n] = ((((2ll * ret1) % MOD + ret2) % MOD) * ret2) % MOD;
    }
    else
    {
        ll k = (n + 1) / 2;
        ll ret1 = fibb(k - 1), ret2 = fibb(k);
        return f[n] = ((ret1 * ret1) % MOD + (ret2 * ret2) % MOD) % MOD;
    }
}

void generateNthrow(int N)
{
    // nC0 = 1
    int prev = 1;
    std::cout << prev;

    for (int i = 1; i <= N; i++) {
        // nCr = (nCr-1 * (n - r + 1))/r
        int curr = (prev * (N - i + 1)) / i;
        std::cout << ", " << curr;
        prev = curr;
    }
}

int logNM(int num1,int num2) {
    

    int counter = 0;
    while (num2) {
        num2 /= num1;
        counter++;
    }
    return counter+1;
}
 //using namespace std;
void run() {
    long long a, b, x; std::cin >> a >> b >> x;
    if (x % a) {
        std::cout << x / a + 1 + (x % a - 1) * b << "\n";
    }
    else {
        std::cout << x / a + b * (a - 1) << "\n";
    }


}

int main() {
    //fastio;
    int t; std::cin >> t;
    while (t--)
        run();

    
}



