#include <bits/stdc++.h>
using namespace std;
long long int maxn = 2000000000;
vector<long long int> ve;
void fib() {
  ve.push_back(1);
  ve.push_back(1);
  for (long long int i = 2; ve[i - 1] < maxn; i++) {
    ve.push_back(ve[i - 1] + ve[i - 2]);
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  fib();
  long long int t;
  cin >> t;
  while (t--) {
    long long int a, b, n;
    cin >> a >> b >> n;
    if (a > n || b > n) {
      cout << "0" << endl;
      continue;
    }
    long long int ca = a, cb = b;
    long long int i = 0, val = 0;
    while (val <= n) {
      val = ve[i] * a + ve[i + 1] * b;
      i++;
    }
    long long int j = 0, val1 = 0;
    while (val1 <= n) {
      val1 = ve[j] * cb + ve[j + 1] * ca;
      j++;
    }
    cout << min(i, j) << endl;
  }
  return 0;
}
