#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedset;
#define MO2 ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl '\n'
#define int long long
#define elif else if
#define sz(x) long(x.size())
#define all(vec) vec.begin(), vec.end()
const int mod = 1e9 + 7;
const int dx[] = {0, -1, 0, 1, 1, -1, 1, -1};
const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1};
int n, m, k;
string s, z;
void dope() {}
bool can (int mid) {
int seats = (m / mid) * mid;
if (m - seats < mid - 1)
seats -= mid;
int rem = m - (seats + mid + 1);
seats += rem;
return seats * n >= k;
}
int BS() {
int l = 1, r = m, ans = -1;
while (l <= r) {
int mid = (l + r) / 2;
if (can (mid)) {
ans = mid;
r = mid - 1;
}
else
l = mid + 1;
}
return ans;
}
void solve() {
cin >> n >> m >> k;
cout << BS();
}
signed main() {
MO2
#if ONLINE_JUDGE || CPH
#else
freopen("Input.txt", "r", stdin);
freopen("Output.txt", "w", stdout);
#endif
int nop = 1; cin >> nop;
while (nop--)
{
solve();
if (nop)
cout << endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxleHQvcGJfZHMvYXNzb2NfY29udGFpbmVyLmhwcD4KI2luY2x1ZGUgPGV4dC9wYl9kcy90cmVlX3BvbGljeS5ocHA+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnVzaW5nIG5hbWVzcGFjZSBfX2dudV9wYmRzOwp0eXBlZGVmIHRyZWU8aW50LCBudWxsX3R5cGUsIGxlc3M8aW50PiwgcmJfdHJlZV90YWcsIHRyZWVfb3JkZXJfc3RhdGlzdGljc19ub2RlX3VwZGF0ZT4gb3JkZXJlZHNldDsKI2RlZmluZSBNTzIgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZS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fHwgQ1BICiNlbHNlCiAgICBmcmVvcGVuKCJJbnB1dC50eHQiLCAiciIsIHN0ZGluKTsKICAgIGZyZW9wZW4oIk91dHB1dC50eHQiLCAidyIsIHN0ZG91dCk7CiNlbmRpZgogICAgaW50IG5vcCA9IDE7ICBjaW4gPj4gbm9wOwogICAgd2hpbGUgKG5vcC0tKQogICAgewogICAgICAgIHNvbHZlKCk7CiAgICAgICAgaWYgKG5vcCkKICAgICAgICAgICAgY291dCA8PCBlbmRsOwogICAgfQogICAgcmV0dXJuIDA7Cn0=