Leo has developed a new programming language C+=. In C+=, integer variables can only be changed with a "+=" operation that adds the right-hand side value to the left-hand side variable. For example, performing "a += b" when a = $2$, b = $3$ changes the value of a to $5$ (the value of b does not change).

In a prototype program Leo has two integer variables a and b, initialized with some positive values. He can perform any number of operations "a += b" or "b += a". Leo wants to test handling large integers, so he wants to make the value of either a or b strictly greater than a given value $n$. What is the smallest number of operations he has to perform?


-----Input-----

The first line contains a single integer $T$ ($1 \leq T \leq 100$) — the number of test cases.

Each of the following $T$ lines describes a single test case, and contains three integers $a, b, n$ ($1 \leq a, b \leq n \leq 10^9$) — initial values of a and b, and the value one of the variables has to exceed, respectively.


-----Output-----

For each test case print a single integer — the smallest number of operations needed. Separate answers with line breaks.


-----Example-----
Input
2
1 2 3
5 4 100

Output
2
7



-----Note-----

In the first case we cannot make a variable exceed $3$ in one operation. One way of achieving this in two operations is to perform "b += a" twice.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Complete search

Implementation

Greedy algorithms


Solutions:
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	x = a > b
	if x:
		c = 0
	else:
		c = 1
	while a <= n and b <= n:
		if c % 2 == 0:
			b += a
			c += 1
		else:
			a += b
			c += 1
	if x:
		print(c)
	else:
		print(c - 1)


for t in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	(a, b) = (max(a, b), min(a, b))
	count = 0
	while a <= n and b <= n:
		count += 1
		(a, b) = (a + b, a)
	print(count)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	ans = 0
	li = [a, b]
	while li[0] <= n and li[1] <= n:
		ans += 1
		li[li.index(min(li))] += max(li)
	print(ans)


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 0
	if a > b:
		(a, b) = (b, a)
	while a <= n:
		a += b
		c += 1
		if a > n:
			break
		if a > b:
			(a, b) = (b, a)
	print(c)


import math
t = int(input())
for w in range(t):
	(a, b, n) = (int(i) for i in input().split())
	(a, b) = (min(a, b), max(a, b))
	c = 0
	while a <= n and b <= n:
		if c % 2 == 0:
			a += b
			c += 1
		else:
			b += a
			c += 1
	print(c)


from sys import stdin, stdout
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()
import math

def p(a):
	print(' '.join(list(map(str, a))))
from collections import Counter

def solve():
	(a, b, n) = MAP()
	x = max(a, b)
	y = min(a, b)
	s = 0
	while n >= x:
		te = x
		x += y
		y = te
		s += 1
	print(s)
for i in range(IN()):
	solve()


rr = lambda : input()
rri = lambda : int(input())
rrm = lambda : list(map(int, input().split()))
INF = float('inf')

def solve(a, b, n):
	ops = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		ops += 1
	return ops
t = int(input())
for _ in range(t):
	(a, b, n) = rrm()
	print(solve(a, b, n))


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 0
	while max(a, b) <= c:
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans = 0
	while b <= n:
		(a, b) = (b, a + b)
		ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	(a, b, n) = [int(j) for j in input().split()]
	count = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		count += 1
	print(count)


import sys

class AC:

	def solve(self, tc=0):
		for _ in range(int(input())):
			import math
			(a, b, n) = [int(_) for _ in input().split()]
			ans = 0
			for i in range(n):
				if a > b:
					b += a
				else:
					a += b
				if min(a, b) > n:
					break
				ans += 1
			print(ans)
solver = AC()
input = sys.stdin.readline
solver.solve()


def go(x, y, k):
	c = 0
	a = min(x, y)
	b = max(x, y)
	while a <= k and b <= k:
		a += b
		c += 1
		if a > k:
			return c
		b += a
		c += 1
		if b > k:
			return c
t = int(input())
for i in range(t):
	(a, b, k) = list(map(int, input().split()))
	print(go(a, b, k))


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	counter = 0
	if b < a:
		temp = a
		a = b
		b = temp
	while b <= n:
		a += b
		temp = a
		a = b
		b = temp
		counter += 1
	print(counter)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	while max(a, b) <= n:
		if a < b:
			a += b
			c += 1
		else:
			b += a
			c += 1
	print(c)


t = int(input())
for i in range(t):
	(a, b, n) = list(map(int, input().split()))
	summ = 0
	c = 0
	while summ <= n:
		if a > b:
			b += a
			summ = b
			c += 1
		else:
			a += b
			summ = a
			c += 1
		if summ > n:
			break
	print(c)


t = int(input())

def fib(N):
	x = 1
	y = 1
	z = x + y
	b = [x, y, z]
	for _ in range(N):
		x = y
		y = z
		z = x + y
		b.append(z)
	return b
d = fib(10000)
for _ in range(t):
	(x, y, n) = map(int, input().split())
	a = min(x, y)
	b = max(x, y)
	if b > n:
		print(0)
	else:
		i = 0
		while i < len(d) - 1 and a * d[i] + b * d[i + 1] <= n:
			i += 1
		print(i + 1)


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		(A, B, N) = map(int, input().split())
		ans = 0
		(n1, n2) = (min(A, B), max(A, B))
		while 1:
			n1 += n2
			ans += 1
			if n1 > N:
				break
			(n1, n2) = (min(n1, n2), max(n1, n2))
		print(ans)
main()


import sys

def solve(a, b, n):
	if b > n:
		return 0
	if a > b:
		t = a
		a = b
		b = t
	return 1 + solve(b, a + b, n)
IN = [x.strip() for x in sys.stdin.readlines()]
T = int(IN[0])
cur = 1
for ti in range(T):
	(a, b, n) = [int(x) for x in IN[cur].split(' ')]
	result = solve(a, b, n)
	print(result)
	cur += 1


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	k = 0
	x = 0
	while a <= n:
		k = a + b
		b = a
		a = k
		x += 1
	print(x)


t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	count = 0
	while 1:
		c = a + b
		(a, b) = (b, c)
		count += 1
		if c > n:
			break
	print(count)
	t -= 1


import sys, math
from collections import defaultdict

def get_ints():
	return map(int, I().split())

def get_list():
	return list(map(int, I().split()))

def I():
	return sys.stdin.readline().strip()
for _ in range(int(I())):
	(a, b, n) = get_ints()
	temp = min(a, b)
	count = 0
	while a <= n:
		(a, b) = (a + b, max(a, b))
		count += 1
	print(count)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	count = 0
	while a <= n and b <= n:
		(a, b) = (max(a, b), min(a, b))
		b += a
		count += 1
		if b > n:
			break
		if a + b > n:
			count += 1
			break
		else:
			a += b
			count += 1
	print(count)


for abn in [list(map(int, input().split())) for _ in range(int(input()))]:
	(a, b, n) = abn
	(b, s) = (max(a, b), min(a, b))
	i = 0
	while b <= n:
		(b, s) = (b + s, b)
		i += 1
	print(i)


t = int(input())
while t != 0:
	(p, q, n) = map(int, input().split())
	count = 0
	a = min(p, q)
	b = max(p, q)
	while a <= n and b <= n:
		a += b
		count += 1
		if a > n:
			break
		b += a
		count += 1
	print(count)
	t -= 1


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	s = 1
	while a + b <= n:
		if a > b:
			b += a
		else:
			a += b
		s += 1
	print(s)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		(a, b, n) = In()
		if a < b:
			m1 = a
			m2 = b
		else:
			m1 = a
			m2 = b
		c = 0
		while m1 <= n and m2 <= n:
			if m1 < m2:
				m1 += m2
			else:
				m2 += m1
			c += 1
		print(c)
main()


T = int(input())
er = []
ll = []
for i in range(T):
	c = 0
	e = input().split()
	a = int(e[0])
	b = int(e[1])
	n = int(e[-1])
	a2 = a
	b2 = b
	while a <= n and b <= n and (a2 <= n) and (b2 <= n):
		if a >= b:
			b += a
			c += 1
		else:
			a += b
			c += 1
		er += [c]
	ll.append(er[-1])
for i in range(len(ll)):
	print(ll[i])


tc = int(input())
for _ in range(tc):
	(a, b, n) = map(int, input().split())
	count = 0
	while a <= n or b <= n:
		if a <= b:
			a = a + b
		else:
			b = b + a
		count = count + 1
	print(count - 1)


def Solve(a, b, n):
	if n < a or n < b:
		return 0
	count = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	return count
T = int(input())
for _ in range(T):
	(a, b, n) = map(int, input().split())
	print(Solve(a, b, n))


q = int(input())
for i in range(q):
	(a, b, n) = list(map(int, input().split()))
	cnt = 0
	while a <= n and b <= n:
		if a >= b:
			b += a
		else:
			a += b
		cnt += 1
	print(cnt)


def solve(a, b, n):
	operations = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		operations += 1
	return operations
t = int(input())
results = list()
for _ in range(0, t):
	(a, b, n) = map(int, input().split(' '))
	results.append(solve(a, b, n))
for result in results:
	print(result)


for g in [*open(0)][1:]:
	(a, b, n) = map(int, g.split())
	x = max(a, b)
	y = min(a, b)
	t = 0
	a = 1
	while x <= n and y <= n:
		if a:
			y += x
		else:
			x += y
		t += 1
		a = 1 - a
	print(t)


for _ in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	e = min(a, b)
	f = max(a, b)
	i = 1
	j = 1
	count = 1
	if a + b > c:
		print(1)
	else:
		while True:
			if j * f + i * e > c:
				break
			else:
				count += 1
				temp = j
				j += i
				i = temp
		print(count)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	(mi, ma) = (min(a, b), max(a, b))
	count = 0
	while mi <= n and ma <= n:
		(mi, ma) = (min(mi, ma), max(mi, ma))
		mi += ma
		count += 1
	print(count)


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	(a, b, n) = stdin.readline().strip().split(' ')
	(a, b, n) = (int(a), int(b), int(n))
	(ta, tb) = (a, b)
	ans = 0
	while not (a > n or b > n):
		a += b
		ans += 1
		if a > n:
			break
		b += a
		ans += 1
		if b > n:
			break
	(a, b) = (ta, tb)
	ans1 = 0
	while not (a > n or b > n):
		b += a
		ans1 += 1
		if b > n:
			break
		a += b
		ans1 += 1
		if a > n:
			break
	stdout.write(str(min(ans, ans1)) + '\n')


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	count = 0
	while a <= n and b <= n:
		if a >= b:
			b += a
		else:
			a += b
		count += 1
	print(count)


cases = int(input())
ans = []
for i in range(cases):
	x = input()
	lista = x.split()
	a = int(lista[0])
	b = int(lista[1])
	k = int(lista[2])
	steps = 0
	while a <= k and b <= k:
		if a < b:
			a += b
		else:
			b += a
		steps += 1
	ans.append(steps)
for i in range(cases):
	print(ans[i])


t = int(input())
while t:
	t -= 1
	(nn, mm, pp) = map(int, input().split())
	ans = 0
	while nn <= pp or mm <= pp:
		if nn > pp or mm > pp:
			break
		if mm >= nn:
			nn += mm
			ans += 1
		else:
			mm += nn
			ans += 1
		if nn > pp or mm > pp:
			break
	print(ans)


import sys, collections, math

def in_out():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	count = 0
	if a > n or b > n:
		print(0)
		continue
	if a > b:
		(a, b) = (b, a)
	while True:
		a += b
		count += 1
		if a > n:
			print(count)
			break
		b += a
		count += 1
		if b > n:
			print(count)
			break


t = int(input())
for test in range(1, t + 1):
	(a, b, n) = map(int, input().split())
	c = 0
	while a <= n and b <= n:
		tmp = max(a, b)
		a += b
		b = tmp
		c += 1
	print(c)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans = 0
	while b <= n:
		c = a + b
		a = b
		b = c
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	x = 0
	while n >= a and n >= b:
		if a > b:
			b += a
			x += 1
		else:
			a += b
			x += 1
	print(x)


cases = int(input())
for _ in range(cases):
	(a, b, n) = map(int, input().split())
	steps = 0
	while a <= n and b <= n:
		if a >= b:
			b = a + b
			steps += 1
		else:
			a = a + b
			steps += 1
	print(steps)


T = int(input())
for _ in range(T):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	count = 0
	while b <= n:
		(a, b) = (b, a + b)
		count += 1
	print(count)


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	d = 0
	while a <= c and b <= c:
		if a < b:
			a += b
		else:
			b += a
		d += 1
	print(d)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import math

def main():
	for _ in range(int(input())):
		ans = 0
		(a, b, n) = [int(x) for x in input().split()]
		while a <= n and b <= n:
			(a, b) = (min(a, b), max(a, b))
			a += b
			ans += 1
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for case in range(t):
	(a, b, n) = [int(s) for s in input().split(' ')]
	steps = 0
	while max(a, b) <= n:
		(a, b) = (max(a, b), min(a, b) + max(a, b))
		steps += 1
	print(steps)


t = int(input())
while t > 0:
	t -= 1
	(a, b, n) = map(int, input().split())
	res = a + b
	a = max(a, b)
	c = 1
	while res <= n:
		b = res
		res = res + a
		a = b
		c += 1
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	l = []
	c = 0
	l.append(min(a, b))
	l.append(max(a, b))
	for j in range(1, 100000):
		if l[j] <= n:
			l.append(l[j] + l[j - 1])
			c = c + 1
		else:
			break
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	count = 0
	x = min(a, b)
	y = max(a, b)
	while y <= n:
		x += y
		temp = x
		x = y
		y = temp
		count += 1
	print(count)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ctr = 0
	f = True
	while a <= n and b <= n:
		if f:
			a = a + b
			f = False
		else:
			b = a + b
			f = True
		ctr += 1
	print(ctr)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a > n or b > n:
		print(0)
		continue
	if a < b:
		temp = b
		b = a
		a = temp
	c = 0
	while a <= n and b <= n:
		if c % 2 == 0:
			b += a
			c += 1
		else:
			a += b
			c += 1
	print(c)


import sys
input = sys.stdin.readline
tc = int(input())
for t in range(tc):
	(a, b, n) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	i = 0
	while True:
		if a > n:
			print(i)
			break
		(a, b) = (a + b, a)
		i += 1


t = int(input())
while t != 0:
	t -= 1
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	i = 0
	while max(a, b) <= n:
		i += 1
		a += b
		(a, b) = (min(a, b), max(a, b))
	print(i)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a > n or b > n:
		print(0)
	else:
		y = max(a, b)
		x = a + b
		t = 1
		while True:
			if x > n:
				print(t)
				break
			else:
				t += 1
				k = x
				x += y
				y = k


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	mx = max(a, b)
	mn = min(a, b)
	count = 0
	t = 0
	while mx <= n and mn <= n:
		if t == 0:
			mn += mx
			t = 1
		else:
			mx += mn
			t = 0
		count += 1
	print(count)


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		cnt += 1
	print(cnt)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	if a < b:
		temp = a
		a = b
		b = temp
	count = 0
	while 1:
		b = b + a
		count = count + 1
		if b > n:
			break
		a = a + b
		count = count + 1
		if a > n:
			break
	print(count)


t = int(input())
fib = [1, 1]

def fibo(n):
	if n <= len(fib):
		return fib[n - 1]
	else:
		tempFib = fibo(n - 1) + fibo(n - 2)
		fib.append(tempFib)
		return tempFib
x = fibo(50)
while t > 0:
	l = [int(x) for x in input().split()]
	(a1, b1, n) = (l[0], l[1], l[2])
	a = min(a1, b1)
	b = a1 + b1 - a
	forB = fib[1:]
	forA = fib
	(i, j) = (0, 0)
	ans = 1
	currNum = a * forA[i] + b * forB[j]
	while currNum <= n:
		i += 1
		j += 1
		currNum = a * forA[i] + b * forB[j]
		ans += 1
	print(ans)
	t -= 1


from math import ceil
t = int(input())
for x in range(t):
	[a, b, n] = list(map(int, input().strip().split()))
	moves = 0
	temp = max(a, b)
	b = min(a, b)
	a = temp
	while a <= n and b <= n:
		if moves % 2 == 0:
			b += a
		else:
			a += b
		moves += 1
	print(moves)


import math
import sys
from itertools import permutations
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	ans = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


import sys
import heapq
import random
import collections

def solve(a, b, c):
	(a, b) = sorted([a, b])
	cnt = 0
	while b <= c:
		cnt += 1
		(a, b) = (b, b + a)
	return cnt

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
for case_num in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	res = solve(a, b, c)
	print(res)


t = int(input())
for i in range(t):
	A = list(map(int, input().split()))
	a = A[0]
	b = A[1]
	n = A[2]
	count = 0
	while (a <= n) & (b <= n):
		count += 1
		if a <= b:
			a += b
		else:
			b += a
	print(count)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	maxi = max(a, b)
	mini = min(a, b)
	a = maxi
	b = mini
	while a <= n and b <= n:
		if c % 2 == 0:
			b += a
		else:
			a += b
		c += 1
	print(c)


def change(a, b):
	a += b
	return (a, b)
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 0
	while a <= n and b <= n:
		(a, b) = change(min(a, b), max(a, b))
		c += 1
	print(c)


test_case = int(input())
result = list()

def countMoves(a, b, n):
	count = 0
	while True:
		if a > n:
			return 0
		if a > b:
			x = b
			y = a
		else:
			x = a
			y = b
		while True:
			x += y
			count += 1
			if x > n:
				return count
			y += x
			count += 1
			if y > n:
				return count
for test in range(test_case):
	(a, b, n) = map(int, input().split())
	result.append(countMoves(a, b, n))
for i in result:
	print(i)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	ans = 0
	while True:
		if max(a, b) > n:
			print(ans)
			break
		else:
			if a < b:
				a += b
			else:
				b += a
			ans += 1


from sys import stdin, stdout
import math
import random

def main():
	t = int(input())
	for i in range(t):
		(a, b, n) = list(map(int, stdin.readline().split()))
		biggest = max(a, b)
		sec_biggest = min(a, b)
		moves = 0
		while biggest <= n:
			moves += 1
			biggest += sec_biggest
			sec_biggest = biggest - sec_biggest
		print(moves)
main()


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	while max(a, b) <= n:
		(x, y) = (min(a, b), max(a, b))
		x += y
		(a, b) = (x, y)
		c += 1
	print(c)


for _in in range(int(input())):
	(a, b, n) = map(int, input().split())
	r = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		r += 1
	print(r)


def solution(a, b, n):
	if n < a or n < b:
		return 0
	count = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	return count
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	print(solution(a, b, n))


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if n == max(a, b):
		print(1)
	else:
		mx = max(a, b)
		curr = a + b
		c = 1
		while n >= curr:
			temp = curr
			curr = curr + mx
			mx = temp
			c += 1
		print(c)


for i in range(int(input())):
	m = 0
	s = 0
	(a, b, n) = map(int, input().split())
	while 1:
		if a < b:
			a += b
		else:
			b += a
		m += 1
		if a > n or b > n:
			break
	print(m)


import math
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	ans = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


t = int(input())
for case in range(t):
	(a, b, n) = map(int, input().split())
	counter = 0
	torf = True
	while torf == True:
		if a >= b:
			b += a
		else:
			a += b
		counter += 1
		if max(a, b) > n:
			print(counter)
			torf = False


t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	count = 0
	while a <= n and b <= n:
		if a < b:
			a += b
			count += 1
		else:
			b += a
			count += 1
	print(count)


t = int(input())
for i in range(0, t):
	(a, b, n) = [int(x) for x in input().split()]
	count = 0
	while a <= n or b <= n:
		if a > b:
			b += a
		else:
			a += b
		count += 1
	print(count - 1)


for i in range(int(input())):
	(n1, n2, m) = map(int, input().split())
	op = 0
	big = n1 if n1 >= n2 else n2
	small = n1 if n1 < n2 else n2
	while big <= m and small <= m:
		if op % 2 == 0:
			small += big
		else:
			big += small
		op += 1
	print(op)


def main():
	t = int(input())
	for _ in range(t):
		(a, b, k) = map(int, input().split())
		i = 0
		while a <= k and b <= k:
			if a < b:
				a = a + b
			else:
				b = b + a
			i += 1
		print(i)
main()


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	(a, b, n) = map(int, input().split())
	ANS = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		ANS += 1
	print(ANS)


t = int(input())
while t > 0:
	LIST = []
	text = input().split(' ')
	if int(text[0]) > int(text[1]):
		LIST.append(int(text[1]))
		LIST.append(int(text[0]))
	else:
		LIST.append(int(text[0]))
		LIST.append(int(text[1]))
	i = 2
	c = 0
	while LIST[-1] <= int(text[2]):
		LIST.append(LIST[i - 1] + LIST[i - 2])
		c += 1
		i += 1
	print(c)
	t -= 1


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	c = 0
	while a <= n and b <= n:
		if a <= b:
			a += b
			c += 1
		else:
			b += a
			c += 1
	print(c)


for i in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	f = [0] * 2
	c = 0
	if a > b:
		(f[0], f[1]) = (b, a)
	if a <= b:
		(f[0], f[1]) = (a, b)
	if a > n or b > n:
		print(0)
		break
	else:
		while True:
			f[0] += f[1]
			c += 1
			if f[0] > n:
				break
			f[1] += f[0]
			c += 1
			if f[1] > n:
				break
	print(c)


t = int(input())
for _ in range(t):
	l = list(map(int, input().split()))
	a = l[0]
	b = l[1]
	n = l[2]
	count = 0
	temp = min(a, b)
	while temp <= n:
		if a >= b:
			b += a
			count += 1
		else:
			a += b
			count += 1
		temp = max(a, b)
		if temp > n:
			break
		if a >= b:
			b = b + a
			count += 1
		else:
			a = a + b
			count += 1
		temp = max(a, b)
	print(count)
	l.clear()


n = int(input())
x = []
for _ in range(n):
	a = list(map(int, input().split()))
	x.append(a)
for ad in x:
	p = ad[:2]
	i = 0
	while True:
		if any((er > ad[2] for er in p)):
			break
		else:
			b = max(p) + min(p)
			p.append(b)
			k = p.pop(p.index(min(p)))
			i = i + 1
	print(i)


import math
tc = int(input())
for ctr in range(tc):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	steps = 0
	while 1:
		(a, b) = (b, a + b)
		steps += 1
		if a > n or b > n:
			print(steps)
			break


t = int(input())
ans = [0] * t
for i in range(t):
	(a, b, n) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	times = 0
	while True:
		if y > n:
			ans[i] = times
			break
		times += 1
		temp = x + y
		x = y
		y = temp
for i in range(t):
	print(ans[i])


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	cnt = 0
	if a > b:
		(a, b) = (b, a)
	while 1:
		if cnt % 2 == 0:
			a += b
			cnt += 1
		else:
			b += a
			cnt += 1
		if a > n or b > n:
			break
	print(cnt)


for u in range(int(input())):
	(a, b, n) = map(int, input().split())
	ka = 0
	s = 0
	while s <= n:
		s = a + b
		b = max(a, b)
		a = s
		ka += 1
	print(ka)


n = int(input())
for _ in range(n):
	(a, b, x) = map(int, input().split())
	(sa, sb) = (min(a, b), max(a, b))
	m = max(a, b)
	k = 0
	while sa <= x or sb <= x:
		sa = sa + sb
		k += 1
		if sa > x:
			break
		elif x - sa < sb:
			k += 1
			break
		sb = sb + sa
		k += 1
		if sb > x:
			break
		elif x - sb < sa:
			k += 1
			break
	print(k)


import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		(n, m, k) = map(int, input().split())
		ans = 0
		while n + m <= k:
			if n > m:
				(n, m) = (m, n)
			n += m
			ans += 1
		if n <= k and m <= k:
			ans += 1
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	ans = 0
	if a > b:
		(a, b) = (b, a)
	while b <= n:
		t = b
		b = a + b
		a = t
		ans = ans + 1
	print(ans)


def solve(a, b, n):
	if n >= a:
		return 1 + solve(a + b, a, n)
	return 0
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	(a, b) = (max([a, b]), min([a, b]))
	ans = solve(a, b, n)
	print(ans)


T = int(input())
ans = []
for i in range(T):
	(a, b, n) = map(int, input().split())
	tot = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		tot += 1
	ans.append(tot)
if len(ans) == 0:
	print(0)
else:
	for i in range(len(ans)):
		print(ans[i])


def countFibs(a, b, n, low, high):
	x = min(a, b)
	y = a + b - x
	(f1, f2) = (y, a + b)
	f3 = f1 + f2
	result = 0
	while f1 <= high:
		if f1 >= low:
			result += 1
		f1 = f2
		f2 = f3
		f3 = f1 + f2
	return result
t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	(low, high) = (0, n)
	print(countFibs(a, b, n, low, high))
	t -= 1


y = int(input())
ans = []
for i in range(y):
	al = input().split()
	m = list(map(int, al))
	a = min(m[0], m[1])
	b = max(m[0], m[1])
	n = m[2]
	steps = 0
	while a <= n and b <= n:
		a = a + b
		steps += 1
		if a > n:
			break
		b = b + a
		steps += 1
	ans.append(steps)
for i in ans:
	print(i)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	a1 = min(a, b)
	b1 = max(a, b)
	c = 0
	while max(a1, b1) <= n:
		a1 = a1 + b1
		t = a1
		a1 = b1
		b1 = t
		c += 1
	print(c)


import sys
from os import path
if path.exists('C:/Users/prana/Desktop/sublime/input.txt'):
	sys.stdin = open('C:/Users/prana/Desktop/sublime/input.txt', 'r')
	sys.stdout = open('C:/Users/prana/Desktop/sublime/output.txt', 'w')

def solve():
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	if a < b:
		a += b
		temp = 0
	else:
		b += a
		temp = 1
	count = 1
	while a <= n and b <= n:
		if temp == 1:
			a += b
			temp = 0
			count += 1
		else:
			b += a
			temp = 1
			count += 1
	print(count)
T = 1
T = int(input())
for _ in range(1, T + 1):
	print('Case #', _, file=sys.stderr)
	solve()


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split(' '))
	count = 0
	a1 = max(a, b)
	b1 = min(a, b)
	while a1 <= n:
		b1 = a1 + b1
		(a1, b1) = (b1, a1)
		count += 1
	print(count)


from math import ceil
for _ in range(int(input())):
	ans = 0
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	while b <= n:
		b += a
		a = b - a
		ans += 1
	print(ans)


import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal

def s():
	return input()

def i():
	return int(input())

def S():
	return input().split()

def I():
	return map(int, input().split())

def L():
	return list(input().split())

def l():
	return list(map(int, input().split()))

def lcm(a, b):
	return a * b // math.gcd(a, b)
sys.setrecursionlimit(10 ** 9)
mod = 10 ** 9 + 7
t = i()
for k in range(t):
	(a, b, n) = I()
	cnt = 0
	for j in range(100):
		if a > b:
			b += a
			cnt += 1
		else:
			a += b
			cnt += 1
		if a > n or b > n:
			print(cnt)
			break


t = int(input())
from math import ceil
for i in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	while True:
		if a > b:
			b += a
			c += 1
		else:
			a += b
			c += 1
		if a > n or b > n:
			print(c)
			break


t = int(input())
for test in range(t):
	(a, b, n) = list(map(int, input().split()))
	if a > b:
		(a, b) = (b, a)
	op = 0
	nums = [a, b]
	while nums[-1] <= n:
		op += 1
		nums.append(nums[-1] + nums[-2])
	print(op)


for k in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 0
	while a <= n and b <= n:
		c += 1
		(a, b) = (max(a, b), min(a, b))
		b += a
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	x1 = 0
	x2 = 1
	y1 = 1
	y2 = 1
	cnt = 0
	while True:
		if x1 * x + y1 * y > n:
			break
		else:
			cnt += 1
			t = x1
			x1 = x2
			x2 = t + x2
			t = y1
			y1 = y2
			y2 = t + y2
	print(cnt)


t = int(input())
for test in range(1, t + 1):
	(a, b, n) = map(int, input().split())
	count = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	print(count)


t = int(input())
for T in range(t):
	(a, b, n) = map(int, input().split())
	kolvo = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		kolvo += 1
	print(kolvo)


n = int(input())
for _ in range(n):
	(a, b, n) = map(int, input().split())
	ct = 0
	a1 = min(a, b)
	b1 = max(a, b)
	while a1 <= n and b1 <= n:
		z = a1 + b1
		if z + b1 < n:
			z1 = b1 + z
			ct += 2
		else:
			z1 = b1
			ct += 1
		a1 = z
		b1 = z1
	print(ct)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	m = min(a, b)
	mm = max(a, b)
	while mm <= n or m <= n:
		m += mm
		c += 1
		if m > n:
			break
		mm += m
		c += 1
		if mm > n:
			break
	print(c)


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
T = 1
T = int(stdin.readline())
for _ in range(T):
	(a, b, n) = list(map(int, stdin.readline().split()))
	c = 0
	(a, b) = (min(a, b), max(a, b))
	(a0, b0) = (min(a, b), max(a, b))
	flag = True
	while flag:
		a += b
		b0 += a0
		c += 1
		if a > n or b0 > n:
			print(c)
			break
		b += a
		a0 += b0
		c += 1
		if b > n or a0 > n:
			print(c)
			break


for _ in range(int(input())):
	l = sorted(list(map(int, input().split())))
	a = l[0]
	b = l[1]
	n = l[2]
	count = 0
	while b <= n:
		a += b
		if a > b:
			(a, b) = (b, a)
		else:
			pass
		count += 1
	print(count)


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	i = 0
	while True:
		if a > n or b > n:
			break
		if a > b:
			b = b + a
		else:
			a = a + b
		i += 1
	print(i)


t = int(input())
for i in range(t):
	A = input().split(' ')
	a = int(A[0])
	b = int(A[1])
	n = int(A[2])
	f1 = min(a, b)
	f2 = max(a, b)
	f = f2
	c = 0
	while f <= n:
		f = f1 + f2
		f1 = f2
		f2 = f
		c += 1
	print(c)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	count = 0
	t = 1
	if a > b:
		(a, b) = (b, a)
	while a <= c and b <= c:
		if t:
			a += b
			t = 0
			count += 1
		else:
			b += a
			t = 1
			count += 1
	print(count)


t = int(input())
while t:
	(a, b, n) = map(int, input().split())
	m1 = max(a, b)
	m2 = min(a, b)
	c = 0
	while 1:
		if m1 > m2:
			m2 += m1
			c += 1
		else:
			m1 += m2
			c += 1
		if m1 > n or m2 > n:
			break
	print(c)
	t -= 1


t = int(input())
a = []
for i in range(t):
	a.append(input())
arr = []
k = 0
for i in a:
	s = i.split()
	a = int(s[0])
	b = int(s[1])
	n = int(s[2])
	while a <= n and b <= n:
		if a < b:
			a += b
			k += 1
		else:
			b += a
			k += 1
	arr.append(k)
	k = 0
for i in arr:
	print(i)


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	c = min(a, b)
	d = c
	e = max(a, b)
	op = 0
	while d <= n and e <= n:
		d += e
		op += 1
		if d <= n and e <= n:
			e += d
			op += 1
	print(op)


t = int(input())
ans = []
for i in range(t):
	(a, b, n) = [int(x) for x in input().split(' ')]
	times = -1
	while a <= n or b <= n:
		if a <= b:
			a += b
			times += 1
		elif a > b:
			b += a
			times += 1
	ans.append(times)
for j in range(t):
	print(int(ans[j]))


for o in range(int(input())):
	(a, b, n) = map(int, input().split())
	s = 0
	while a <= n and b <= n:
		if a < b:
			a = a + b
		else:
			b = b + a
		s += 1
	print(s)


for _ in range(int(input())):
	c = 0
	(a, b, n) = map(int, input().split())
	m = 0
	mx = max(a, b)
	while True:
		if mx > n:
			print(c)
			break
		else:
			m = a + b
			a = m
			b = mx
			c = c + 1
			mx = m


T = int(input())
while T:
	T -= 1
	(a, b, n) = [int(x) for x in input().split()]
	c = 0
	if a > b:
		(a, b) = (b, a)
	count = 0
	while c <= n:
		c = a + b
		a = b
		b = c
		count += 1
	print(count)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	ctr = 0
	while a <= n and b <= n:
		if a < b:
			a = a + b
			ctr += 1
			continue
		else:
			b = a + b
			ctr += 1
			continue
	print(ctr)


t = int(input())
for tt in range(t):
	(a, b, n) = map(int, input().split())
	q = 0
	if a > b:
		(a, b) = (b, a)
	if a <= n and b <= n:
		while True:
			c = b
			b = a + b
			a = c
			q = q + 1
			if b > n:
				break
	print(q)


def ans(a):
	i = max(a[0], a[1])
	j = min(a[0], a[1])
	c = 0
	while i <= a[2]:
		j += i
		i1 = max(i, j)
		j = min(i, j)
		i = i1
		c += 1
	return c
t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	print(ans(a))


def main():
	T = int(input())
	for _ in range(T):
		(a, b, n) = map(int, input().split())
		if b > a:
			(a, b) = (b, a)
		if a > n:
			print(0)
			continue
		z = 0
		while True:
			z += 1
			(a, b) = (a + b, a)
			if a > n:
				print(z)
				break
main()


def fun(a, b, n):
	c = 0
	while True:
		if a <= n and b <= n:
			a += b
			c += 1
			if a > n or b > n:
				return c
			b += a
			c += 1
			if a > n or b > n:
				return c
		else:
			return c
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	print(fun(a, b, n))


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
entries = inp()
for i in range(entries):
	l = inlt()
	a = l[0]
	b = l[1]
	n = l[2]
	res = max(a, b)
	prev_res = min(a, b)
	count = 0
	while res <= n:
		tmp = res
		res = res + prev_res
		prev_res = tmp
		count += 1
	print(count)


t = input()
for r in range(int(t)):
	(a, b, n) = map(int, input().split())
	m = 0
	while max(a, b) <= n:
		if a > b:
			b += a
		else:
			a += b
		m += 1
	print(m)


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	answer = 0
	(a, b) = (min(a, b), max(a, b))
	while True:
		answer += 1
		num = a + b
		(a, b) = (b, num)
		if num > n:
			break
	print(answer)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	while True:
		if a > n or b > n:
			print(c)
			break
		else:
			if a < b:
				a = a + b
			else:
				b = a + b
			c = c + 1


T = int(input())
for test in range(T):
	(a, b, n) = map(int, input().split(' '))
	res = 0
	while a <= n and b <= n:
		res += 1
		if a < b:
			a += b
		else:
			b += a
	print(res)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	k = 0
	while max(a, b) <= n:
		(a, b) = (max(a, b), min(a, b))
		b += a
		k += 1
	print(k)


import math
t = int(input())
for qq in range(t):
	(a, b, n) = [int(i) for i in input().split()]
	if a > b:
		(a, b) = (b, a)
	c = b
	s = 0
	while b <= n:
		c = a + b
		a = b
		b = c
		s += 1
	print(s)


from sys import stdin, stdout
from collections import deque
R = lambda : stdin.readline().strip()
RL = lambda : list(map(int, R().split(' ')))

def fib(n):
	F = [[1, 1], [1, 0]]
	if n == 0:
		return 0
	power(F, n - 1)
	return F[0][0]

def multiply(F, M):
	x = F[0][0] * M[0][0] + F[0][1] * M[1][0]
	y = F[0][0] * M[0][1] + F[0][1] * M[1][1]
	z = F[1][0] * M[0][0] + F[1][1] * M[1][0]
	w = F[1][0] * M[0][1] + F[1][1] * M[1][1]
	F[0][0] = x
	F[0][1] = y
	F[1][0] = z
	F[1][1] = w

def power(F, n):
	M = [[1, 1], [1, 0]]
	for i in range(2, n + 1):
		multiply(F, M)
T = int(R())
for _ in range(T):
	(a, b, n) = RL()
	for i in range(100):
		ans = max(fib(i) * a + fib(i + 1) * b, fib(i) * b + fib(i + 1) * a)
		if ans > n:
			print(i)
			break


def solve():
	[a, b, n] = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	ops = 0
	while b <= n:
		(a, b) = (b, a + b)
		ops += 1
	return ops
for _ in range(int(input())):
	print(solve())


x = int(input())
l = []
for i in range(x):
	(a, b, n) = str(input()).split(' ')
	a = int(a)
	b = int(b)
	n = int(n)
	sum = 0
	if a > b:
		sum = a
		a = b
		b = sum
	count = 0
	while n >= b:
		count = count + 1
		sum = a + b
		a = b
		b = sum
	l.append(count)
for i in l:
	print(i)


from sys import stdin, stdout, setrecursionlimit
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	ans = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


import math

def main():
	for t in range(int(input())):
		(a, b, c) = map(int, input().split())
		cnt = 0
		if a > b:
			tmp = b
			b = a
			a = tmp
		while b <= c and a <= c:
			if cnt % 2 == 0:
				a += b
				cnt += 1
			else:
				b += a
				cnt += 1
		print(cnt)
main()


test = int(input())
while test != 0:
	(a, b, n) = [int(x) for x in input().split()]
	if b > a:
		(a, b) = (b, a)
	count = 0
	while a <= n and b <= n:
		b += a
		if b > a:
			(a, b) = (b, a)
		count += 1
	print(count)
	test -= 1


from sys import stdin

def inp():
	return stdin.readline().strip()
for _ in range(int(inp())):
	(a, b, n) = [int(k) for k in inp().split()]
	isTurnA = b > a
	turns = 0
	while not (a > n or b > n):
		if isTurnA:
			a += b
			isTurnA = False
		else:
			b += a
			isTurnA = True
		turns += 1
	print(turns)


for i in range(int(input())):
	(a, b, k) = map(int, input().split())
	count = 0
	while max(a, b) <= k:
		if a <= b:
			a += b
		else:
			b += a
		count += 1
	print(count)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin, stdout
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math
import math
import time
from queue import Queue

def seive(n):
	l = [True]
	l = l * (n + 1)
	for i in range(2, int(sqrt(n)) + 1):
		if l[i] == True:
			val = i * i
			while val < len(l):
				l[val] = False
				val += i
	prime = []
	for i in range(2, len(l)):
		if l[i] == True:
			prime.append(i)
	return prime

def dp(l, i, n, val, ans):
	if i >= n or val < 0:
		return 1000000
	elif val == 0:
		return 0
	else:
		if ans[i] == 1000000:
			ans[i] = min(min(1 + dp(l, i + 1, n, val - l[i], ans), 1 + dp(l, i, n, val - l[i], ans)), dp(l, i + 1, n, val, ans))
		return ans[i]
from queue import Queue

def factors(n):
	l = []
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def check1(s, v, x):
	while True:
		if v not in s:
			return v
		else:
			v -= 1

def check2(s, v, x):
	while True:
		if v not in s:
			return v
		else:
			v += 1
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split(' '))
	c = 0
	while a <= n or b <= n:
		if a > n or b > n:
			break
		if a >= b:
			b += a
		else:
			a += b
		c += 1
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	temp = a
	flag = 0
	count = 0
	prevb = b
	preva = a
	while temp <= n:
		count += 1
		if flag == 0:
			temp += prevb
			prevb = temp
			flag = 1
		else:
			temp += preva
			preva = temp
			flag = 0
	print(count)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	step = 0
	if a > b:
		(a, b) = (b, a)
	while a <= n and b <= n:
		a += b
		step += 1
		if a <= n and b <= n:
			b += a
			step += 1
	print(step)


T = int(input())
while T > 0:
	(a, b, n) = map(int, input().split())
	res = 0
	if a > b:
		(a, b) = (b, a)
	while a + b <= n:
		(a, b) = (b, a + b)
		res += 1
	res += 1
	print(res)
	T -= 1


def c(a, b, n):
	counter = 0
	while True:
		if a > n or b > n:
			return 0
		elif a <= b:
			counter += 1
			a += b
			if a > n or b > n:
				return counter
		else:
			counter += 1
			b += a
			if a > n or b > n:
				return counter
t = int(input())
for _ in range(t):
	ipt = input().split()
	print(c(a=int(ipt[0]), b=int(ipt[1]), n=int(ipt[2])))


from math import *

def rr(t):
	zzz = [t(i) for i in input().split()]
	if len(zzz) == 1:
		return zzz[0]
	return zzz

def r3(t):
	return [t(i) for i in input()]
for _ in range(rr(int)):
	(a, b, n) = rr(int)
	x = min(a, b)
	y = max(a, b)
	ans = 0
	while y <= n:
		ans += 1
		x += y
		a = min(x, y)
		b = max(x, y)
		x = a
		y = b
	print(ans)


T = int(input())
for f in range(T):
	x = 0
	(a, b, n) = map(int, input().split())
	p = True
	if a > b or a == b:
		Big = a
		Small = b
	else:
		Big = b
		Small = a
	while Big <= n and Small <= n:
		if p:
			Small += Big
			p = False
		else:
			Big += Small
			p = True
		x += 1
	print(x)


tc = int(input())
for _ in range(tc):
	(a, b, N) = map(int, input().split())
	res = 0
	while max(a, b) <= N:
		sum = a + b
		if max(a, b) == a:
			b = sum
		else:
			a = sum
		res += 1
	print(res)


import math
from decimal import *
getcontext().prec = 30
t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	(i, x, y) = (0, 1, 1)
	while 1:
		i += 1
		if x * a + y * b > n:
			print(i)
			break
		temp = x
		x += y
		y = temp


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 0
	while b <= n:
		(a, b) = (max(a, b), a + b)
		c += 1
	print(c)


def main():
	for _ in range(int(input())):
		(a, b, n) = [int(i) for i in input().split()]
		t = 0
		if a > b:
			(a, b) = (b, a)
		while b <= n:
			a += b
			if a > b:
				(a, b) = (b, a)
			t += 1
		print(t)
main()


t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	ans = 0
	while True:
		if a > n or b > n:
			break
		if a > b:
			b += a
		else:
			a += b
		ans += 1
	print(ans)


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
N = 10 ** (-6)
for _ in range(I()):
	(a, b, n) = R()
	op = 0
	while max(a, b) <= n:
		if b > a:
			a += b
		else:
			b += a
		op += 1
	print(op)


t = int(input())
for i in range(t):
	aMaiorB = False
	cont = 0
	(a, b, n) = [int(i) for i in input().split()]
	while a <= n and b <= n:
		if a > b:
			amaiorB = True
			b += a
		else:
			a += b
		cont += 1
	print(cont)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans

def nc2(x):
	if x == 1:
		return 0
	else:
		return x * (x - 1) // 2
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	li = [min(a, b), max(a, b)]
	cnt = 0
	sel = 1
	while li[0] <= n and li[1] <= n:
		cnt += 1
		sel ^= 1
		li[sel] = sum(li)
	print(cnt)


import math

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b / gcd(a, b)

def bs(arr, l, r, x):
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return arr[mid]
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def swap(list, pos1, pos2):
	(list[pos1], list[pos2]) = (list[pos2], list[pos1])
	return list
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	i = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		i += 1
	print(i)


import sys
from math import log2, floor
TEST = 0
if TEST == 1:
	input_file = open('inputA.txt', 'r')
	input_from_file = input_file.readlines()

def read_int():
	if TEST:
		return int(input_from_file.pop(0))
	else:
		return int(sys.stdin.readline())

def read_ints():
	if TEST:
		return list(map(int, input_from_file.pop(0).rstrip().split()))
	else:
		return list(map(int, sys.stdin.readline().split()))

def read_str_to_list():
	if TEST:
		in1 = input_from_file.pop(0).rstrip()
	else:
		in1 = sys.stdin.readline().rstrip()
	return [x for x in in1]
t = read_int()
for test in range(t):
	(a, b, n) = read_ints()
	if b > a:
		(a, b) = (b, a)
	if a > n:
		ans = 0
	else:
		(fk, fkm1) = (1, 1)
		k = 0
		while fk * a + fkm1 * b <= n:
			(fkm1, fk) = (fk, fk + fkm1)
			k += 1
		ans = k + 1
	print(ans)


t = int(input())
(x, y, z) = (0, 0, 0)
l = []
for i in range(t):
	l.append(input().split())
for i in range(len(l)):
	count = 0
	x = int(l[i][0])
	y = int(l[i][1])
	z = int(l[i][2])
	while x < z + 1 and y < z + 1:
		if x < y:
			x += y
			count += 1
		else:
			y += x
			count += 1
	print(count)


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def solve():
	(a, b, n) = rl()
	steps = 0
	while max(a, b) <= n:
		steps += 1
		if a <= b:
			a = a + b
		else:
			b = a + b
	print(steps)
mode = 'T'
if mode == 'T':
	t = ri()
	for i in range(t):
		solve()
else:
	solve()


t = int(input())
for i in range(t):
	abn = list(map(int, input().split(' ')))
	a = None
	b = None
	count = 0
	if abn[0] > abn[1]:
		a = abn[0]
		b = abn[1]
	else:
		a = abn[1]
		b = abn[0]
	while a <= abn[2] and b <= abn[2]:
		b += a
		a += b
		count += 2
	if a > abn[2] and b > abn[2]:
		print(count - 1)
	else:
		print(count)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	te = a + b
	a = max(a, b)
	b = te
	an = 1
	while a <= c and b <= c:
		te = a + b
		a = b
		b = te
		an = an + 1
	print(an)


def f(a, b, n, m):
	if a > n or b > n:
		return m
	elif a < b:
		return f(a + b, b, n, m + 1)
	else:
		return f(a, b + a, n, m + 1)
for i in range(int(input())):
	l = input().split()
	print(f(int(l[0]), int(l[1]), int(l[2]), 0))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def fibonacci(n):
	(a, b) = (0, 1)
	for i in range(n):
		yield a
		(a, b) = (b, a + b)
data = list(fibonacci(50))
for _ in range(ii()):
	(a, b, n) = mi()
	ans = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


for t in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	cnt = 0
	while a <= n and b <= n:
		temp = min(a, b)
		if a < b:
			a += b
		else:
			b += a
		cnt += 1
	print(cnt)


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	(ans, su) = (0, 0)
	while su <= n:
		if a > b:
			b += a
			su = b
			ans = ans + 1
		else:
			a += b
			su = a
			ans = ans + 1
		if su > n:
			break
	print(ans)


t = int(input())
for k in range(t):
	(a, b, c) = map(int, input().split())
	if a > b:
		f = b
		l = a
	else:
		f = a
		l = b
	val = 0
	while f <= c and l <= c:
		if f > l:
			l = l + f
		else:
			f = f + l
		val += 1
	print(val)


mp = lambda : list(map(int, input().split()))
(t,) = mp()
for _ in range(t):
	(a, b, n) = mp()
	count = x = 0
	while x <= n:
		count += 1
		x = a + b
		a = max(a, b)
		b = x
	print(count)


import sys
infile = sys.stdin
next(infile)
for line in infile:
	l = list(map(int, line.split()))
	a = l[0]
	b = l[1]
	n = l[2]
	k = 1
	step = 0
	i = a
	j = b
	while k != 0:
		if i + j > n:
			step = step + 1
			k = 0
		else:
			t = j
			j = i + j
			i = max(i, t)
			step = step + 1
	print(step)


n = int(input())
for j in range(n):
	z = 0
	(a, b, k) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	while a <= k or b <= k:
		if a <= k:
			a += b
			z += 1
		if a > k:
			break
		if b <= k:
			b += a
			z += 1
		if b > k:
			break
	print(z)


for i in range(int(input())):
	count = 0
	(a, b, c) = map(int, input().split())
	if a > c or b > c:
		print(0)
	else:
		mi = min(a, b)
		ma = max(a, b)
		flag = 0
		while mi + ma <= c:
			if ma > mi:
				flag = 1
				mi = mi + ma
				count = count + 1
			else:
				flag = 0
				ma = mi + ma
				count = count + 1
		print(count + 1)


def main():
	for _ in range(int(input())):
		(a, b, c) = map(int, input().split())
		(a, b) = (max(a, b), min(a, b))
		ans = 0
		while a <= c and b <= c:
			if ans % 2 == 0:
				b += a
			else:
				a += b
			ans += 1
		print(ans)
main()


t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	count = 0
	while x <= n:
		p = x
		x += y
		y = p
		count += 1
	print(count)
	t -= 1


t = int(input())
for m in range(t):
	abn = list(map(int, input().split()))
	steps = 0
	while abn[0] <= abn[2] and abn[1] <= abn[2]:
		if abn[0] <= abn[1]:
			abn[0] += abn[1]
		else:
			abn[1] += abn[0]
		steps += 1
	print(steps)


import sys
from math import ceil
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
tc = int(input())
for zzz in range(tc):
	(a, b, n) = map(int, input().split())
	if b < a:
		(a, b) = (b, a)
	i = 1
	while True:
		a += b
		if a > n:
			print(i)
			break
		(a, b) = (b, a)
		i += 1


def solve(a, b, n):
	mx = max(a, b)
	mn = min(a, b)
	count = 0
	while mx <= n and mn <= n:
		if count % 2 == 0:
			mn += mx
		else:
			mx += mn
		count += 1
	return count
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a == 0 and b == 0:
		print(0)
	else:
		print(solve(a, b, n))


tests = int(input())
for test in range(tests):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	operation = 0
	while a <= n and b <= n:
		a += b
		(a, b) = (b, a)
		operation += 1
	print(operation)


for _ in range(int(input())):
	(a, b, n) = map(int, input().strip().split(' '))
	y = max(a, b)
	x = min(a, b)
	c = 0
	while 1:
		x = x + y
		c += 1
		if x > n:
			break
		y = y + x
		c += 1
		if y > n:
			break
	print(c)


def solve(a, b, n):
	c = 0
	if a > b:
		b += a
		while a <= n or b <= n:
			if a > b:
				b += a
			else:
				a += b
			c += 1
	else:
		a += b
		while a <= n or b <= n:
			if b > a:
				a += b
			else:
				b += a
			c += 1
	return c
for _ in range(int(input())):
	c = 0
	(a, b, n) = map(int, input().split())
	print(solve(a, b, n))


def read_list():
	return list(map(int, input().strip().split(' ')))

def print_list(l):
	print(' '.join(map(str, l)))
N = int(input())
for _ in range(N):
	(a, b, n) = read_list()
	res = 0
	(a, b) = (min(a, b), max(a, b))
	while b <= n:
		(a, b) = (b, a + b)
		res += 1
	print(res)


import sys
sys.setrecursionlimit(10000)
t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	large = max(a, b)
	small = min(a, b)
	ans = 0
	newans = large
	while newans <= n:
		ans += 1
		large = newans
		newans += small
		small = large
	print(ans)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	co = False
	f = 0
	while True:
		if x > n or y > n:
			print(f)
			break
		else:
			pass
		if co == False:
			y += x
			f += 1
			co = True
		else:
			x += y
			f += 1
			co = False


tc = int(input().strip())
while tc:
	(a, b, n) = map(int, input().strip().split())
	cnt = 0
	while a <= n and b <= n:
		c = a + b
		a = max(a, b)
		b = c
		cnt += 1
	print(cnt)
	tc -= 1


y = int(input())
for i in range(y):
	c = 0
	(a, b, n) = [int(x) for x in input().split()]
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		c += 1
	print(c)


t = int(input())
for _ in range(t):
	(a, b, n) = [int(x) for x in input().split()]
	count = 0
	c = [a, b]
	b = max(c)
	a = min(c)
	c = a + b
	while a + b <= n:
		d = b
		b += a
		a = d
		count += 1
	print(count + 1)


from math import *
from random import *
for t in range(int(input())):
	(a, b, n) = map(int, input().split())
	otv = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		otv += 1
	print(otv)


from sys import stdin
input = stdin.readline
q = int(input())
for _ in range(q):
	(a, b, n) = map(int, input().split())
	kroki = 0
	while max(a, b) <= n:
		if a > b:
			(a, b) = (b, a)
		a = a + b
		kroki += 1
	print(kroki)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	c = 0
	while True:
		if b > n or a > n:
			break
		a = a + b
		c = c + 1
		if b > n or a > n:
			break
		b = b + a
		c = c + 1
	print(c)


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree1:

	def __init__(self, data, default=9999999, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] > k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for i in range(int(input())):
	(a, b, k) = map(int, input().split())
	ans = 0
	if a + b > k:
		print(1)
		continue
	while True:
		if a <= b:
			a += b
		else:
			b += a
		ans += 1
		if a > k or b > k:
			break
	print(ans)


for i in range(int(input())):
	abn = list(map(int, input().split()))
	g = 0
	while abn[0] <= abn[2] and abn[1] <= abn[2]:
		abn[abn.index(min(abn[:2]))] += abn[abn.index(max(abn[:2]))]
		g += 1
	print(g)


for _ in range(int(input())):
	(A, B, N) = map(int, input().split())
	count = 0
	while True:
		if A > N or B > N:
			break
		elif A > B:
			B = A + B
			count += 1
		else:
			A = A + B
			count += 1
	print(count)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	p = min(a, b)
	q = max(a, b)
	c = 0
	x = 0
	while x <= n:
		x = p + q
		p = q
		q = x
		c = c + 1
	print(c)


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	(a, b, n) = inputnums()
	count = 0
	while a <= n:
		if a > b:
			(a, b) = (b, a)
		a += b
		count += 1
	print(count)


for _ in range(int(input())):
	counter = 0
	(a, b, c) = list(map(int, input().split()))
	x = False
	if a > b:
		t = b
		b = a
		a = t
	while a <= c or b <= c:
		x = True
		a += b
		counter += 1
		if a > c:
			print(counter)
			break
		else:
			b += a
			counter += 1
			if b > c:
				print(counter)
				break
	if x == False:
		print(1)


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	ans = 0
	cnt = 0
	while ans != 1:
		if a >= b:
			b += a
			cnt += 1
			if b > n:
				ans = 1
		else:
			a += b
			cnt += 1
			if a > n:
				ans = 1
	print(cnt)


import math
import sys
sys.setrecursionlimit(10 ** 4)

def Divisors(n):
	l = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
		i = i + 1
	return l

def SieveOfEratosthenes(n):
	l = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			l.append(p)
	return l

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(n)
	return l

def Factors(n):
	result = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			if i == n / i:
				result.append(i)
			else:
				result.append(i)
				result.append(n // i)
	result.append(1)
	result.append(n)
	return result

def maxSubArraySum(a):
	max_so_far = 0
	max_ending_here = 0
	size = len(a)
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
		if max_ending_here < 0:
			max_ending_here = 0
	return max_so_far

def longestsubarray(arr, n, k):
	current_count = 0
	max_count = 0
	for i in range(0, n, 1):
		if arr[i] % k != 0:
			current_count += 1
		else:
			current_count = 0
		max_count = max(current_count, max_count)
	return max_count

def main():
	(a, b, n) = list(map(int, input().split()))
	c = 0
	if a > n or b > n:
		print(0)
	else:
		if b < a:
			c = a
			a = b
			b = c
		c = 0
		while a <= n and b <= n:
			a += b
			c += 1
			if a > n or b > n:
				print(c)
				break
			b += a
			c += 1
			if a > n or b > n:
				print(c)
				break
t = int(input())
for i in range(0, t):
	main()


t = int(input())
count = 0
i = 0
result = []
for e in range(t):
	numbers = [int(s) for s in input().split(' ')]
	n = numbers[2]
	if numbers[1] > numbers[0]:
		a = numbers[0]
		b = numbers[1]
	else:
		a = numbers[1]
		b = numbers[0]
	while a <= n and b <= n:
		if i:
			b += a
			i = 0
			count += 1
		else:
			a += b
			i = 1
			count += 1
	result.append(count)
	count = 0
	i = 0
for m in result:
	print(str(m))


for k in range(int(input())):
	res = 0
	(a, b, c) = map(int, input().split())
	while a <= c or b <= c:
		if a + b > c:
			res += 1
			break
		elif a < b:
			a += b
			res += 1
		else:
			b += a
			res += 1
	print(res)


t = int(input())
for _ in range(t):
	l = list(map(int, input().split()))
	x = 0
	while l[0] <= l[2] and l[1] <= l[2]:
		x += 1
		if l[0] < l[1]:
			l[0] += l[1]
		else:
			l[1] += l[0]
	print(x)


tot = int(input().strip())
while tot > 0:
	(a, b, n) = [int(x) for x in input().strip().split(' ', 2)]
	cnt = 0
	while max(a, b) <= n:
		if a > b:
			t = a
			a = b
			b = t
		a += b
		cnt += 1
	print(cnt)
	tot -= 1


import math
t = int(input())
for _ in range(t):
	(a, b, n) = [int(c) for c in input().split()]
	(ad, bd) = (a, b)
	if b < a:
		(a, b) = (b, a)
	c = 0
	op = True
	while a <= n and b <= n:
		if op:
			a += b
		else:
			b += a
		op = not op
		c += 1
	x = math.ceil((n + 1 - bd) / ad)
	y = math.ceil((n + 1 - ad) / bd)
	print(min(x, y, c))


for __ in range(int(input())):
	(a, b, n) = map(int, input().split())
	i = 0
	if a > b:
		(a, b) = (b, a)
	while a <= n and b <= n:
		if i % 2 == 0:
			a += b
		else:
			b += a
		i += 1
	print(i)


import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	if b < a:
		(a, b) = (b, a)
	count = 0
	while a <= n and b <= n:
		a += b
		(a, b) = (b, a)
		count += 1
	sys.stdout.write(str(count) + '\n')


for __ in range(int(input())):
	(a, b, n) = map(int, input().split())
	s = [0] * 200
	(s[0], s[1]) = (min(a, b), max(b, a))
	for i in range(2, 101):
		s[i] = s[i - 1] + s[i - 2]
	for i in range(len(s)):
		if s[i] > n:
			j = i
			break
	print(j - 1)


try:
	k = int(input())
	for i in range(k):
		a = list(map(int, input().split()))
		a1 = a[0]
		a2 = a[1]
		n = a[2]
		count = 0
		while a1 <= n and a2 <= n:
			count += 1
			if a1 >= a2:
				a2 += a1
			else:
				a1 += a2
		print(count)
except Exception:
	pass


n = int(input())
for i in range(n):
	(a, b, c) = input().split(' ')
	a = int(a)
	b = int(b)
	c = int(c)
	ctt = 0
	while True:
		if a < b:
			a += b
			ctt += 1
			if a > c:
				break
		else:
			b += a
			ctt += 1
			if b > c:
				break
	print(ctt)
	ctt = 0


t = int(input())
for z in range(t):
	(a, b, n) = map(int, input().split())
	count = 0
	(small, large) = (min(a, b), max(a, b))
	(a, b) = (small, large)
	while a <= n and b <= n:
		a += b
		count += 1
		(small, large) = (min(a, b), max(a, b))
		(a, b) = (small, large)
	print(count)


test_case = int(input())
for i in range(test_case):
	(a, b, n) = input().split(' ')
	(a, b, n) = (int(a), int(b), int(n))
	ans = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


t = int(input())
a = []
b = []
n = []
for i in range(t):
	(x, y, z) = map(int, input().split())
	a.append(x)
	b.append(y)
	n.append(z)
for i in range(t):
	f = 0
	l = []
	count = 0
	l.append(a[i])
	l.append(b[i])
	while f < 1:
		l.sort()
		if l[0] > n[i] or l[1] > n[i]:
			f = 1
		else:
			l[0] = l[0] + l[1]
			count += 1
	print(count)


t = int(input())
while t:
	(A, B, n) = map(int, input().split())
	k = 0
	c = 0
	a = min(A, B)
	b = max(A, B)
	while 1:
		if k == 0:
			k = 1
			a += b
		elif k == 1:
			k = 0
			b += a
		c += 1
		if a > n or b > n:
			break
	print(c)
	t -= 1


def ans(a, b, n):
	k = 0
	if a > n or b > n:
		return 0
	else:
		while True:
			if a > n or b > n:
				break
			elif a < b:
				a += b
				k += 1
			else:
				b += a
				k += 1
		return k
t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	print(ans(a, b, n))


from math import ceil
t = int(input())
for _ in range(t):
	(a, b, n) = [int(x) for x in input().split()]
	swap = True
	k = 0
	if b < a:
		(b, a) = (a, b)
	while a <= n and b <= n:
		if swap:
			a += b
		else:
			b += a
		swap = not swap
		k += 1
	print(k)


t = int(input())
for i in range(t):
	(n, m, k) = list(map(int, input().split()))
	count = 0
	while n <= k and m <= k:
		if n > m:
			m += n
		else:
			n += m
		count += 1
	print(count)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	max_ = max(a, b)
	min_ = min(a, b)
	c = 0
	while True:
		min_ += max_
		min1 = min(min_, max_)
		max1 = max(max_, min_)
		min_ = min1
		max_ = max1
		c += 1
		if min_ > n or max_ > n:
			break
	print(c)


p = int(input())
for _ in range(p):
	(a, b, n) = map(int, input().split())
	count = 0
	while a <= n and b <= n:
		(a, b) = (max(a, b), max(a, b) + min(a, b))
		count += 1
	print(count)


N = int(input())
for q in range(N):
	(a, b, n) = tuple(map(int, input().split()))
	count = 1
	while a + b <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	print(count)


class Solve:

	def op(self, a, b, n, nop):
		if b > n:
			return nop
		return self.op(b, a + b, n, nop + 1)

	def solve(self):
		for i in range(int(input())):
			(a, b, n) = [int(x) for x in input().split()]
			(a, b) = (min(a, b), max(a, b))
			print(self.op(a, b, n, 0))

def main():
	s = Solve()
	s.solve()
main()


import math
t = int(input())
for _ in range(t):
	(a, b, n) = [int(i) for i in input().split()]
	if a > b:
		t = b
		b = a
		a = t
	if a > n or b > n:
		print(0)
		continue
	a1 = 1
	b1 = 1
	s = 0
	m = 0
	while s <= n:
		s = a1 * a + b1 * b
		t = a1 + b1
		a1 = b1
		b1 = t
		m += 1
	print(m)


for _ in range(int(input())):
	(x, y, n) = map(int, input().split())
	count = 0
	a = max(x, y)
	b = min(x, y)
	while 1:
		if b <= n:
			b += a
			count += 1
		elif b > n:
			break
		if a <= n:
			a += b
			count += 1
		elif a > n:
			break
	print(count - 1)


production = True
import sys, math, collections

def input(input_format=0, multi=0):
	if multi > 0:
		return [input(input_format) for i in range(multi)]
	else:
		next_line = sys.stdin.readline()[:-1]
		if input_format >= 10:
			use_list = False
			input_format = int(str(input_format)[-1])
		else:
			use_list = True
		if input_format == 0:
			formatted_input = [next_line]
		elif input_format == 1:
			formatted_input = list(map(int, next_line.split()))
		elif input_format == 2:
			formatted_input = list(map(float, next_line.split()))
		elif input_format == 3:
			formatted_input = next_line.split()
		elif input_format == 4:
			formatted_input = (lambda x: [x[0], list(map(int, x[1:]))])(next_line.split())
		elif input_format == 5:
			formatted_input = (lambda x: [x[0], list(map(float, x[1:]))])(next_line.split())
		else:
			formatted_input = [next_line]
		return formatted_input if use_list else formatted_input[0]

def out(output_line, output_format=0, newline=True):
	formatted_output = ''
	if output_format == 0:
		formatted_output = str(output_line)
	elif output_format == 1:
		formatted_output = ' '.join(map(str, output_line))
	elif output_format == 1:
		formatted_output = '\n'.join(map(str, output_line))
	print(formatted_output, end='\n' if newline else '')

def log(*args):
	if not production:
		print('$$$', end='')
		print(*args)
enum = enumerate

def solve():
	(a, b, n) = input(1)
	c = 0
	while a <= n and b <= n:
		log(a, b)
		if a < b:
			a += b
		else:
			b += a
		c += 1
	out(c)
	return
for i in range(input(11)):
	solve()


def solve(x, y, n):
	if x > n:
		return 1
	x += y
	ans = 1 + solve(y, x, n)
	return ans
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a < b:
		print(solve(a, b, n) - 2)
	else:
		print(solve(b, a, n) - 2)


t = int(input())
for _ in range(t):
	abn = list(map(int, input().split(' ')))
	a = abn[0]
	b = abn[1]
	n = abn[2]
	count = 0
	while a <= n or b <= n:
		if a > b:
			b += a
		else:
			a += b
		count += 1
	print(count - 1)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for i in range(t):
		abn = list(map(int, input().split()))
		(a, b, n) = (abn[0], abn[1], abn[2])
		(mx, mn) = (max(a, b), min(a, b))
		ans = 1
		s = mx + mn
		while s <= n:
			temp = s
			s = mx + s
			mx = temp
			ans += 1
		print(ans)
main()


t = int(input())
for __ in range(t):
	(a, b, n) = map(int, input().split())
	c = max(a, b)
	d = min((a, b))
	i = 1
	for j in range(1, 10000):
		if j % 2 != 0:
			if c + d > n:
				break
			else:
				(c, d) = (c, c + d)
				i += 1
		elif c + d > n:
			break
		else:
			(c, d) = (c + d, d)
			i += 1
	print(i)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	if x > n:
		print(0)
	else:
		r = 0
		while x <= n:
			if x + y > n:
				r += 1
				break
			elif x + 2 * y > n:
				r += 2
				break
			elif 2 * x + y > n:
				r += 2
				break
			else:
				y += x
				x += y
				r += 2
		print(r)


from sys import stdin, stdout
Pi = lambda x: stdout.write(str(x) + '\n')
Ps = lambda x: stdout.write(str(x))
S = lambda x: x * (x + 1) // 2
I = lambda x: 1 + 2 * x
R = lambda : stdin.readline()
Ri = lambda x: map(int, x.split())
Rs = lambda x: map(str, x.split())
Rf = lambda x: map(float, x.split())
char = lambda x, y: ord(x) - ord(y)
gcd = lambda a, b: a if b == 0 else gcd(b, a % b)
lcm = lambda a, b: a * b // gcd(a, b)
distance = lambda a, b, c, d: (a - c) ** 2 + (b - d) ** 2
MaxN = int(1000000.0) + 10
mod = int(1000000000.0) + 7

def f(i, n, dp, inc, A):
	if dp[i] != -1:
		return dp[i]
	ans = 0
	for j in range(i + inc, n, inc):
		if A[j] < A[i]:
			ans = max(ans, f(j, n, dp, inc, A) + 1)
	dp[i] = ans
	return dp[i]

def main():
	for x in stdin:
		if x == '\n':
			continue
		cases = int(x)
		for t in range(cases):
			(a, b, n) = Ri(R())
			if a + b > n:
				Pi(1)
			else:
				ans = 0
				if a > b:
					(a, b) = (b, a)
				while max(a, b) <= n:
					ans += 1
					if ans & 1:
						a += b
					else:
						b += a
				Pi(ans)
main()


t = int(input())
for q in range(t):
	(a, b, n) = map(int, input().split())
	ans = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	x = 0
	while max(a, b) <= n:
		y = max(a, b)
		z = a + b
		(a, b) = (y, z)
		x += 1
	print(x)


def newLang(a, b, n):
	if a > n or b > n:
		return 0
	x = max(a, b)
	y = min(a, b)
	return 1 + newLang(x + y, x, n)
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	print(newLang(a, b, n))


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	cnt = 0
	while a <= n:
		a += b
		cnt += 1
		if a > n:
			break
		if a + b > n:
			cnt += 1
			break
		else:
			b += a
			cnt += 1
			if b > n:
				break
			if b + a > n:
				cnt += 1
				break
	print(cnt)


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline().rstrip()

def lsi():
	return list(si())
res = ['Yes', 'No']
test_case = ii()
while test_case:
	test_case -= 1
	(a, b, n) = mi()
	if a < b:
		(b, a) = (a, b)
	c = 0
	while a <= n and b <= n:
		if c % 2:
			a += b
		else:
			b += a
		c += 1
	print(c)


t = int(input())
o = 0
for test in range(t):
	(a, b, n) = map(int, input().split())
	if a >= b:
		while a <= n or b <= n:
			b += a
			o += 1
			if b > n:
				print(o)
				o = 0
				break
			else:
				a += b
				o += 1
				if a > n:
					print(o)
					o = 0
					break
	elif b > a:
		while a <= n or b <= n:
			a += b
			o += 1
			if a > n:
				print(o)
				o = 0
				break
			else:
				b += a
				o += 1
			if b > n:
				print(o)
				o = 0
				break


t = int(input())

def fib(n):
	if n == 1:
		return [0]
	if n == 2:
		return [0, 1]
	l = [0, 1]
	a = 0
	b = 1
	for i in range(n - 1):
		t = a
		a = b
		b += t
		l.append(b)
	return l

def f(a, b, n):
	i = 0
	c = a
	d = b
	while a <= n and b <= n:
		if a <= n and b <= n:
			a += b
			i += 1
		if a <= n and b <= n:
			b += a
			i += 1
	j = 0
	while c <= n and d <= n:
		if c <= n and d <= n:
			d += c
			j += 1
		if c <= n and d <= n:
			c += d
			j += 1
	return min(i, j)
for _ in range(t):
	l = list(map(int, input().split()))
	a = l[0]
	b = l[1]
	n = l[2]
	print(f(a, b, n))


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	s = 0
	while b <= c:
		(a, b) = (b, a + b)
		s = s + 1
	print(s)


import math
q = int(input())
for i in range(q):
	(a, b, n) = [int(x) for x in input().split()]
	cnt = 0
	while a <= n and b <= n:
		cnt += 1
		if a + b > n:
			a = a + b
			break
		elif a < b:
			a = a + b
		else:
			b = a + b
	print(cnt)


for i in range(0, int(input())):
	(a, b, n) = list(map(int, input().split()))
	d = 0
	j = 0
	while a <= n and b <= n:
		if j == 0:
			if a < b:
				q = b
				q = q + a
				if q > n:
					d = d + 1
					break
				a = a + b
				d = d + 1
				p = a
			else:
				q = a
				q = q + b
				if q > n:
					d = d + 1
					break
				b = b + a
				d = d + 1
				p = b
		elif p == a:
			q = a
			q = q + b
			if q > n:
				d = d + 1
				break
			b = b + a
			p = b
			d = d + 1
		else:
			q = b
			q = q + a
			if q > n:
				d = d + 1
				break
			a = a + b
			p = a
			d = d + 1
		j = j + 1
	print(d)


import math

def caca(a, b, n):
	res = 0
	while a + b <= n:
		if min(a, b) == a:
			a += b
		else:
			b += a
		res += 1
	return res + 1
g = int(input())
c = []
for i in range(g):
	(a, b, n) = map(int, input().split(' '))
	c.append(str(caca(a, b, n)))
print('\n'.join(c))


import sys
import math
from sys import stdin, stdout

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def main():
	for t in range(int(input())):
		(a, b, n) = get_ints()
		c = 0
		while 1:
			if a > b:
				(a, b) = (b, a)
			a += b
			c += 1
			if a > n:
				break
		print(c)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


cases_number = int(input())
answers = [0 for i in range(cases_number)]
for i in range(cases_number):
	m = input().split()
	n = int(m[2])
	a = max(int(m[0]), int(m[1]))
	b = int(m[0]) + int(m[1])
	cont = 1
	while b <= n:
		c = b
		b = a + b
		a = c
		cont += 1
	answers[i] = cont
for answer in answers:
	print(answer)


for _ in range(int(input())):
	lis = list(map(int, input().split()))
	(a, b) = (lis[0], lis[1])
	n = lis[2]
	cnt = 0
	while a <= n and b <= n:
		if a <= b:
			a += b
			cnt += 1
		else:
			b += a
			cnt += 1
	print(cnt)


T = int(input())
while T:
	(a, b, n) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	c = 0
	while x <= n:
		c = c + 1
		y = y + x
		a = max(x, y)
		b = min(x, y)
		x = a
		y = b
	print(c)
	T = T - 1


import math

def main():
	for _ in range(int(input())):
		(a, b, n) = list(map(int, input().split()))
		(a, b) = (max(a, b), min(a, b))
		(x, t) = (0, 0)
		while n >= a and n >= b:
			if x % 2 == 0:
				t = a
				a += b
				b = t
			else:
				b += a
				(a, b) = (b, a)
			x += 1
		print(x)
main()


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	flag = True
	count = 0
	while flag:
		if a > n or b > n:
			flag = False
		else:
			sum = a + b
			count += 1
			if a >= b:
				b = sum
			else:
				a = sum
	print(count)


t = int(input().strip())
for x in range(t):
	(a, b, n) = map(int, input().strip().split())
	if a > b:
		(a, b) = (b, a)
	ans = 0
	while b <= n:
		a += b
		(a, b) = (b, a)
		ans += 1
	print(ans)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 0
	(a, b) = sorted([a, b])
	while a <= n and b <= n:
		a += b
		(a, b) = (b, a)
		c += 1
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if (a or b) > n:
		print('0')
	else:
		e = max(a, b)
		w = a + b
		x = 1
		while w <= n:
			r = w
			w = w + e
			e = r
			x += 1
	print(x)


t = int(input())
for i in range(t):
	arr = list(map(int, input().rstrip().split()))
	a = arr[0]
	b = arr[1]
	n = arr[2]
	l = a
	m = b
	c1 = 0
	while a <= n and b <= n:
		a += b
		c1 += 1
		if a > n:
			break
		b += a
		c1 += 1
	c2 = 0
	while l <= n and m <= n:
		m += l
		c2 += 1
		if m > n:
			break
		l += m
		c2 += 1
	if c1 < c2:
		print(c1)
	else:
		print(c2)


for _ in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	answer = 0
	while max(a, b) <= n:
		if a > b:
			b += a
		else:
			a += b
		answer += 1
	print(answer)


for t in range(int(input())):
	(a, b, n) = [int(i) for i in input().split()]
	l = [a, b] if a < b else [b, a]
	while l[-1] <= n:
		l.append(l[-1] + l[-2])
	print(len(l) - 2)


import math
t = int(input())
rez = []
for i in range(t):
	k = 0
	A = input().split(' ')
	a = min(int(A[0]), int(A[1]))
	b = max(int(A[0]), int(A[1]))
	n = int(A[2])
	while b <= n:
		r = a
		a = b
		b += r
		k += 1
	rez.append(k)
for i in range(len(rez)):
	print(rez[i])


t = int(input())
for q in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	(a, b, n) = (L[0], L[1], L[2])
	if b > a:
		(a, b) = (b, a)
	i = 0
	while True:
		if max(a, b) > n:
			break
		b += a
		i += 1
		if max(a, b) > n:
			break
		a += b
		i += 1
		if max(a, b) > n:
			break
	print(i)


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	count = 0
	for i in range(1, c + 1):
		if a >= b:
			if b > c or a > c:
				break
			else:
				b += a
				count += 1
		elif a > c or b > c:
			break
		else:
			a += b
			count += 1
	print(count)


t = int(input())
for i in range(t):
	k = 0
	(a, b, n) = map(int, input().split())
	if a == n or b == n:
		print(1)
		continue
	while a <= n and b <= n:
		if a >= b:
			b += a
		elif b > a:
			a += b
		k += 1
	print(k)


def solve(a, b, n):
	count = 1
	while a + b <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	return count
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	print(solve(a, b, n))


for _ in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	x = min(a, b)
	y = max(a, b)
	ss = 0
	while x <= n and y <= n:
		if ss % 2:
			y = y + x
		else:
			x = x + y
		ss += 1
	print(ss)


from sys import stdin, stdout
q = int(input())
for i in range(q):
	(a, b, n) = list(map(int, stdin.readline().split()))
	if b > a:
		(a, b) = (b, a)
	cnt = 0
	while a <= n:
		temp = a
		a = a + b
		b = temp
		cnt += 1
	print(cnt)


t = int(input())
while t:
	(a, b, n) = map(int, input().split())
	a1 = a
	b1 = b
	a2 = a
	b2 = b
	i = 0
	while a1 <= n and b1 <= n:
		if i % 2:
			a1 = a1 + b1
		else:
			b1 = b1 + a1
		i = i + 1
	j = 0
	while a2 <= n and b2 <= n:
		if j % 2:
			b2 = b2 + a2
		else:
			a2 = a2 + b2
		j = j + 1
	print(min(i, j))
	t = t - 1


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 0
	while 1:
		k = a
		l = b
		a = min(k, l)
		b = max(k, l)
		if a > n or b > n:
			break
		else:
			a += b
			c += 1
	print(c)


def codepro(a, b, n):
	count = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		count += 1
	return count
t = int(input())
for i in range(t):
	arr = list(map(int, input().strip().split()))[:3]
	a = arr[0]
	b = arr[1]
	n = arr[2]
	result = codepro(a, b, n)
	print(result)


T = int(input())
for t in range(T):
	(a, b, n) = [int(i) for i in input().split()]
	(small, big) = (min(a, b), max(a, b))
	if big > n:
		print(0)
		continue
	ans = 0
	while True:
		small += big
		ans += 1
		if small > n:
			print(ans)
			break
		big += small
		ans += 1
		if big > n:
			print(ans)
			break


for _ in range(int(input())):
	abn = input().split(' ')
	a = int(abn[0])
	b = int(abn[1])
	n = int(abn[2])
	maxi = max([a, b])
	mini = min([a, b])
	i = 0
	while maxi <= n:
		mini = maxi + mini
		temp = maxi
		maxi = mini
		mini = temp
		i += 1
	print(i)


t = int(input())
for testCase in range(t):
	x = 0
	str = input()
	a = ''
	b = ''
	n = ''
	for c in str:
		if c != ' ':
			n += c
		else:
			b = n
			n = ''
	while str[x] != ' ':
		a += str[x]
		x += 1
	a = int(a)
	b = int(b)
	n = int(n)
	cont = 0
	if a < b:
		while a <= n and b <= n:
			a += b
			cont += 1
			if a > n:
				break
			else:
				b += a
				cont += 1
	else:
		while a <= n and b <= n:
			b += a
			cont += 1
			if b > n:
				break
			else:
				a += b
				cont += 1
	print(cont)


t = int(input())
for i in range(t):
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	x = a
	y = b
	cnt = 0
	while y <= n:
		x += y
		p = x
		x = y
		y = p
		cnt += 1
	x = a
	y = b
	ans = 0
	while x <= n:
		y += x
		p = x
		x = y
		y = p
		ans += 1
	print(min(cnt, ans))


def solve():
	(a, b, N) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	if b > N:
		return 0
	ans = 0
	while True:
		c = a + b
		a = b
		b = c
		ans += 1
		if c > N:
			return ans
	return ans

def main():
	for _ in range(int(input())):
		print(solve())
main()


from collections import *
from math import *
t = int(input())
for y in range(t):
	(a, b, n) = list(map(int, input().split()))
	o = 0
	if a > b:
		(a, b) = (b, a)
	while b <= n:
		a += b
		(a, b) = (b, a)
		o += 1
	print(o)


import os
import sys
import math
from io import BytesIO, IOBase
t = int(sys.stdin.readline())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	count = 0
	while a <= n:
		a += b
		count += 1
		if a > n:
			break
		if a + b > n:
			count += 1
			break
		else:
			b += a
			count += 1
			if b > n:
				break
			if b + a > n:
				count += 1
				break
	print(count)


x = int(input())
for i in range(x):
	(a, b, n) = map(int, input().split())
	montante = 0
	contagem = 0
	while montante < n + 1:
		if a <= b:
			a += b
			montante = a
			contagem += 1
		else:
			b += a
			montante = b
			contagem += 1
	print(contagem)


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	d = max(a, b)
	b = min(a, b)
	cnt = e = 0
	while d <= c:
		b = b + d
		e = d
		d = b
		b = e
		cnt += 1
	print(cnt)


for _t in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	(a, b) = (min(a, b), max(a, b))
	ans = 0
	s = 1
	while a <= n and b <= n:
		if s:
			a += b
		else:
			b += a
		s = 1 - s
		ans += 1
	print(ans)


def min_step(num1, num2, end, temp):
	if (num1 or num2) > end:
		return temp
	else:
		x = min(num1, num2)
		y = max(num1, num2)
		x += y
		temp += 1
		return min_step(x, y, end, temp)
trial = int(input())
for i in range(trial):
	(a, b, n) = map(int, input().split())
	print(min_step(a, b, n, 0))


t = int(input())
while t > 0:
	inp = list(map(int, input().split()))
	a = inp[0]
	b = inp[1]
	n = inp[2]
	count = 0
	while a <= n and b <= n:
		temp = min(a, b)
		tempo = max(a, b)
		if temp == a:
			a += b
		else:
			b += a
		count += 1
	print(count)
	t -= 1


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	tot = 0
	while max(a, b) <= n:
		tot += 1
		if a < b:
			a += b
		else:
			b += a
	print(tot)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	d = 0
	while max(a, b) <= n:
		if a <= b:
			a = a + b
		else:
			b = b + a
		d = d + 1
	print(d)


k = int(input())
I = []
for i in range(k):
	s = list(map(int, input().split()))
	I.append(s)

def output(a, b, n):
	if a > n or b > n:
		return 0
	l = [a, b]
	l.sort()
	count = 0
	i = 1
	while True:
		if i % 2 != 0:
			l[0] = sum(l)
			count += 1
		else:
			l[1] = sum(l)
			count += 1
		if l[0] > n or l[1] > n:
			return count
		i += 1
for i in range(k):
	print(output(I[i][0], I[i][1], I[i][2]))


t = int(input())
for test in range(t):
	(a, b, n) = [int(item) for item in input().split()]
	cnt = 0
	while a <= n and b <= n:
		cnt += 1
		if a > b:
			b = b + a
		else:
			a = a + b
	print(cnt)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	p = min(a, b)
	q = max(a, b)
	count = 0
	while q <= n and p <= n:
		p += q
		if p <= n:
			count += 1
		else:
			break
		q += p
		if q <= n:
			count += 1
		else:
			break
	print(count + 1)


for _ in range(int(input())):
	(a, b, n) = [int(i) for i in input().split()]
	if a < b:
		(a, b) = (b, a)
	c = 0
	while a <= n:
		(a, b) = (a + b, a)
		c += 1
	print(c)


t = int(input())
for i in range(t):
	line = input()
	pi = line.split()
	a = int(pi[0])
	b = int(pi[1])
	n = int(pi[2])
	count = 0
	while a <= n and b <= n:
		if a > b:
			b = a + b
		else:
			a = a + b
		count = count + 1
	print(count)


from collections import defaultdict as dd
import math
import sys
import string
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))
q = nn()
for _ in range(q):
	(a, b, n) = mi()
	ops = 1
	sval = min(a, b)
	mval = max(a, b)
	sum = sval + mval
	while sum <= n:
		new_sval = mval
		mval = sval + mval
		sval = new_sval
		sum = mval + sval
		ops += 1
	print(ops)


import math
t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	if a > n or b > n:
		print(0)
		t -= 1
		continue
	ans = 0
	(h, k) = (1, 1)
	while True:
		if k * a + h * b > n:
			ans += 1
			break
		e = h + k
		h = k
		k = e
		ans += 1
	print(ans)
	t -= 1


T = int(input())
for test in range(T):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	count = 0
	while a <= n and b <= n:
		nexnum = a + b
		a = b
		b = nexnum
		count += 1
	print(count)


from sys import stdin, stdout
import heapq as hq
from collections import defaultdict
from math import ceil
t = int(input())
for tc in range(t):
	(a, b, n) = list(map(int, stdin.readline().split()))
	res = 0
	if a < b:
		(a, b) = (b, a)
	while a <= n:
		b = a + b
		(a, b) = (b, a)
		res += 1
	stdout.write(str(res) + '\n')


t = int(input())
for i in range(0, t):
	abn = input().split()
	a = int(abn[0])
	b = int(abn[1])
	c = int(abn[2])
	L = [min(a, b), max(a, b)]
	count = 0
	while L[-1] <= c:
		L.append(L[-1] + L[-2])
		count += 1
	print(count)


def tester(a, b, n):
	runs = 0
	if a > n or b > n:
		return 0
	while True:
		a += b
		runs += 1
		if a > n:
			return runs
		b += a
		runs += 1
		if b > n:
			return runs
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	print(tester(a, b, n))


def main() -> None:
	for test in range(int(input())):
		(a, b, n) = map(int, input().split())
		ans = 0
		while a <= n and b <= n:
			if a <= b:
				a += b
			else:
				b += a
			ans += 1
		print(ans)
main()


t = int(input())
for i in range(t):
	(a, b, c) = [int(x) for x in input().split()]
	cont = 0
	while a <= c and b <= c:
		if a <= b:
			a += b
		elif b < a:
			b += a
		cont += 1
	print(cont)


for _ in range(int(input())):
	(c, d, n) = map(int, input().split())
	a = min(c, d)
	b = max(c, d)
	if a > n or b > n:
		print('0')
	else:
		c = 0
		while a <= n and b <= n:
			if a < b:
				a = a + b
				c = c + 1
			else:
				b = b + a
				c = c + 1
	print(c)


ll = lambda : list(map(int, input().split()))
st = lambda : input()
v = lambda : map(int, input().split())
ii = lambda : int(input())
from collections import *
import math
for _ in range(ii()):
	(x, y, n) = v()
	c = 0
	while max(x, y) <= n:
		if x < y:
			x += y
		else:
			y += x
		c += 1
	print(c)


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	s = []
	while a <= n and b <= n:
		if a < b:
			a += b
			s.append(1)
			if a > n:
				break
			else:
				b += a
				s.append(1)
				if b > n:
					break
		else:
			b += a
			s.append(1)
			if b > n:
				break
			else:
				a += b
				s.append(1)
				if a > n:
					break
	k = len(s)
	print(k)


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	t1 = min([a, b])
	t2 = max([a, b])
	count = 0
	n = 0
	while n <= c:
		n = t1 + t2
		t1 = t2
		t2 = n
		count += 1
	print(count)


T = int(input())
for i in range(T):
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	count = 0
	tmp_max = 0
	if max(a, b) == a:
		tmp_bool = False
	elif max(a, b) == b:
		tmp_bool = True
	while max(a, b) <= c:
		if tmp_bool:
			a += b
			tmp_bool = False
		else:
			b += a
			tmp_bool = True
		count += 1
	print(count)


import sys
input = sys.stdin.buffer.readline
t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	count = 1
	c = a + b
	d = max(a, b)
	if d > n:
		print('0')
	else:
		while c <= n:
			count += 1
			e = max(c, d)
			c += d
			d = e
		print(count)


def fun(a, b, n):
	c = 0
	i = 1
	while a <= n and b <= n:
		if i % 2 == 0:
			b = b + a
			c = c + 1
			i = i + 1
		else:
			a = a + b
			c = c + 1
			i = i + 1
	print(c)
	return
t = int(input())
for i in range(0, t):
	ls1 = list(map(int, input().rstrip().split()))
	a = ls1[0]
	b = ls1[1]
	n = ls1[2]
	if a > b:
		fun(b, a, n)
	else:
		fun(a, b, n)


def countSetBits(n):
	count = 0
	while n:
		count += n & 1
		n >>= 1
	return count
import math

def bubble_sort(c):
	n = len(c)
	for i in range(n):
		already_sorted = True
		for j in range(n - i - 1):
			if c[j][0] < c[j + 1][0]:
				(c[j][0], c[j + 1][0]) = (c[j + 1][0], c[j][0])
				already_sorted = False
			if c[j][0] == c[j + 1][0]:
				if c[j][1] > c[j + 1][1]:
					(c[j][1], c[j + 1][1]) = (c[j + 1][1], c[j][1])
		if already_sorted:
			break
	return c

def fun(l, r):
	if l > r:
		return
	m = (l + r) // 2
	c.append([l - r, m])
	fun(l, m - 1)
	fun(m + 1, r)
t = int(input())
while t:
	t -= 1
	(n, m, p) = map(int, input().split())
	ans = 0
	while n <= p or m <= p:
		if n > p or m > p:
			break
		if m >= n:
			n += m
			ans += 1
		else:
			m += n
			ans += 1
		if n > p or m > p:
			break
	print(ans)


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	(a, b, n) = map(int, input().split())
	(a, b) = sorted([a, b])
	cnt = 0
	while a <= n and b <= n:
		if cnt % 2 == 1:
			b += a
		else:
			a += b
		cnt += 1
	print(cnt)
t = int(input())
for _ in range(t):
	main()


for _ in range(int(input())):
	(a, b, n) = [int(i) for i in input().split()]
	ma = max(a, b)
	mi = min(a, b)
	c1 = 0
	if ma > n:
		print(0)
	else:
		while 1:
			j1 = ma
			ma = max(ma, mi)
			mi = min(j1, mi)
			ma1 = ma + mi
			if ma1 > n:
				c1 += 1
				break
			else:
				mi = ma1
				j1 = ma
				c1 += 1
		print(c1)


m = int(input())
for x in range(m):
	(a, b, n) = [int(x) for x in input().split()]
	k = 0
	a = int(a)
	b = int(b)
	n = int(n)
	while a <= n or b <= n:
		if a <= b:
			a += b
			k += 1
		else:
			b += a
			k += 1
	else:
		print(k - 1)


n = int(input(''))
s = 0
for i in range(n):
	(a, b, x) = input('').split()
	a = int(a)
	b = int(b)
	x = int(x)
	mx = max(a, b)
	mn = min(a, b)
	cnt = 0
	if x <= mx:
		print('1')
	else:

		def func(s, mx, mn, x):
			cnt = 0
			while s <= x:
				s = mx + mn
				mn = mx
				mx = s
				cnt = cnt + 1
			print(cnt)
		func(s, mx, mn, x)
exit()


def solve(a, b, n):
	(a, b) = (min(a, b), max(a, b))
	count = 0
	while b <= n and a <= n:
		(a, b) = (min(a, b), max(a, b))
		a = a + b
		count = count + 1
	return count
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	print(solve(a, b, n))


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def DFS(n, s, adj):
	visited = [False for i in range(n + 1)]
	stack = []
	stack.append(s)
	while len(stack):
		s = stack[-1]
		stack.pop()
		if not visited[s]:
			visited[s] = True
		for node in adj[s]:
			if not visited[node]:
				stack.append(node)

def solve():
	(a, b, n) = num_input()
	maxx = max(a, b)
	minn = min(a, b)
	op = 0
	while maxx <= n:
		minn += maxx
		(minn, maxx) = (maxx, minn)
		op += 1
	print(op)
t = int(input())
for _ in range(t):
	solve()


test = int(input())
for i in range(test):
	(a, b, n) = [int(x) for x in input().split(' ')]
	m = max(a, b)
	temp = a + b
	count = 1
	while temp <= n:
		prev = temp
		temp += m
		m = prev
		count += 1
	print(count)


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
t = oint()
for _ in range(t):
	(a, b, n) = rint()
	cnt = 0
	while not a > n and (not b > n):
		if a > b:
			b += a
		else:
			a += b
		cnt += 1
	print(cnt)


for tt in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 0
	while a <= n and b <= n:
		minn = min(a, b)
		maxx = max(a, b)
		minn = minn + maxx
		if a < b:
			a = minn
			b = maxx
		else:
			a = maxx
			b = minn
		c += 1
	print(c)


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	(a, b, n) = mInt()
	c = 0
	if a > b:
		(a, b) = (b, a)
	while b <= n:
		a += b
		c += 1
		(a, b) = (b, a)
	print(c)


def call():
	(x, y, n) = map(int, input().split())
	coN = 0
	while x <= n and y <= n:
		if x > y:
			(x, y) = (y, x)
		x += y
		coN += 1
	print(coN)
for _ in range(int(input())):
	call()


for _ in range(int(input().strip())):
	(a, b, target) = map(int, input().strip().split())
	i = 0
	while max(a, b) <= target:
		i += 1
		mx = max(a, b)
		if mx == a:
			b += a
		else:
			a += b
	print(i)


t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	ans = 0
	if a > b:
		(a, b) = (b, a)
	if max(a, b) > n:
		print(0)
		continue
	curr = 0
	while curr <= n:
		curr = a + b
		ans += 1
		a = b
		b = curr
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	(a, b, n) = map(int, input().split())
	z = 0
	while a <= n or b <= n:
		if a < b:
			a += b
			z += 1
		else:
			b += a
			z += 1
	print(z - 1)


import atexit
import io
import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	c = 0
	while a <= n and b <= n:
		if c % 2 == 0:
			a += b
		else:
			b += a
		c += 1
	print(c)


numberTestCases = int(input())
solutions = []

def countMinimumOperations(integer1, integer2, integer3):
	if integer1 > integer3 or integer2 > integer3:
		return 0
	return 1 + countMinimumOperations(max(integer1, integer2), integer1 + integer2, integer3)
for test in range(numberTestCases):
	integerValuesString = input().split(' ')
	firstInteger = int(integerValuesString[0])
	secondInteger = int(integerValuesString[1])
	integerToExceed = int(integerValuesString[2])
	testSolution = countMinimumOperations(firstInteger, secondInteger, integerToExceed)
	solutions.append(testSolution)
for solution in solutions:
	print(solution)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().strip().split())
	c = 0
	if a == n:
		a += b
		c += 1
	elif b == n:
		b += a
		c += 1
	else:
		while a <= n and b <= n:
			if a > b:
				b += a
				c += 1
			else:
				a += b
				c += 1
	print(c)


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	if a == n or b == n:
		print(1)
	else:
		t = a + b
		if t > n:
			print(1)
		else:
			t1 = t
			t += max(a, b)
			if t > n:
				print(2)
			else:
				i = 2
				while t <= n:
					t2 = t1 + t
					t1 = t
					t = t2
					i += 1
				print(i)


t = int(input())
for i in range(0, t):
	a = [int(x) for x in input().split(' ')]
	if a[0] < a[1]:
		p = a[0]
		q = a[1]
	else:
		q = a[0]
		p = a[1]
	n = a[2]
	m = 0
	while 1:
		if p > n or q > n:
			break
		p += q
		m += 1
		if p > n:
			break
		q += p
		m += 1
		if q > n:
			break
	print(m)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	c1 = max(a, b)
	c2 = min(a, b)
	while True:
		if c1 <= n:
			c2 += c1
			c += 1
		else:
			break
		if c1 < c2:
			temp = c1
			c1 = c2
			c2 = temp
	print(c)


t = int(input())
for i in range(t):
	op = 1
	(a, b, n) = [int(x) for x in input().split()]
	s = a + b
	while n >= s:
		b = max(a, b)
		a = s
		s = a + b
		op += 1
	print(op)


t = int(input())
ans = []
for i in range(t):
	(a, b, n) = [int(i) for i in input().split()]
	x = max(a, b)
	count = 0
	while x <= n:
		x = min(a, b)
		x += max(a, b)
		temp = max(a, b)
		a = x
		b = temp
		count += 1
	ans.append(count)
for i in ans:
	print(i)


def main():
	count = input()
	for i in range(int(count)):
		inputstr = input()
		numbers = inputstr.split()
		a = int(numbers[0])
		b = int(numbers[1])
		n = int(numbers[2])
		counter = 0
		while a <= n and b <= n:
			if a < b:
				a += b
			else:
				b += a
			counter += 1
		print(counter)
main()


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	c1 = 0
	c2 = 0
	t1 = a
	t2 = b
	t3 = a
	t4 = b
	while t1 <= n and t2 <= n:
		if c1 % 2 == 0:
			t1 += t2
		else:
			t2 += t1
		c1 += 1
	while t3 <= n and t4 <= n:
		if c2 % 2 == 0:
			t4 += t3
		else:
			t3 += t4
		c2 += 1
	print(min(c1, c2))


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	move = 0
	num1 = min(a, b)
	num2 = max(a, b)
	temp = 0
	while True:
		num1 += num2
		move += 1
		if num1 > n:
			break
		temp = num2
		num2 = num1
		num1 = temp
	print(move)


T = int(input())
D = []
for i in range(0, T):
	(a, b, n) = [int(x) for x in input().split(' ')]
	X = 0
	while a <= n and b <= n:
		if a < b:
			(a, b) = (b, a)
		(a, b) = (a, b + a)
		X += 1
	D.append(X)
for i in D:
	print(i)


t = int(input())
for i in range(0, t):
	(a, b, n) = input().split()
	x = int(a)
	y = int(b)
	n = int(n)
	count = 0
	while n != 0:
		count = count + 1
		t1 = min(x, y)
		t2 = max(x, y)
		t1 = t1 + t2
		if t1 > n:
			break
		x = t1
		y = t2
	print(count)


t = int(input())
for i in range(t):
	str = input()
	list = str.split(' ')
	a = int(list[0])
	b = int(list[1])
	n = int(list[2])
	ctr = 0
	while a <= n and b <= n:
		if a <= b:
			a = b + a
			ctr = ctr + 1
		else:
			b = a + b
			ctr = ctr + 1
	print(ctr)


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = int(input())
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	(a, b, n) = invr()
	if a > b:
		(a, b) = (b, a)
	if a + b > n:
		print(1)
	else:
		max_f = n // (a + b)
		f = list()
		x1 = 1
		x2 = 1
		f.append(x1)
		f.append(x2)
		while x2 <= max_f:
			f.append(x1 + x2)
			(x1, x2) = (x2, x1 + x2)
		ans = len(f)
		for i in range(len(f) - 1, -1, -1):
			if f[i] * b + f[i - 1] * a <= n:
				break
			ans = i
		print(ans)


t = int(input())
for i in range(0, t):
	(a, b, n) = input().split()
	(a, b, n) = [int(a), int(b), int(n)]
	if a > b:
		te = a
		a = b
		b = te
	c = 0
	while b <= n:
		k = b
		b += a
		a = k
		c += 1
	print(c)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	ans = []
	for _ in range(n):
		(a, b, c) = LI()
		cnt = 0
		while True:
			(a, b) = sorted([a, b])
			if c < b:
				break
			cnt += 1
			a += b
		ans.append(cnt)
	for x in ans:
		print(x)
main()


def answer():
	n = int(input())
	while n:
		z = input().split()
		z = [int(x) for x in z]
		a = min(z[0], z[1])
		b = max(z[1], z[0])
		targ = z[2]
		ans = 0
		while z[2] >= b:
			temp = b
			b += a
			a = temp
			ans += 1
		print(ans)
		n -= 1
answer()


import sys
lines = sys.stdin.readlines()
T = int(lines[0].strip())

def solve(a, b, n):
	if a > b:
		return solve(b, a, n)
	if max(a, b) > n:
		return 0
	return 1 + solve(b, a + b, n)
for t in range(T):
	(a, b, c) = map(int, lines[t + 1].strip().split(' '))
	print(solve(a, b, c))


n = int(input())
for _ in range(n):
	(x, y, z) = map(int, input().split())
	out = 0
	m = max(x, y)
	e = min(x, y)
	while z >= m and z >= e:
		e += m
		out += 1
		l = [m, e]
		m = max(l)
		e = min(l)
	print(out)


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(a, b, n):
	(a, b) = (min(a, b), max(a, b))
	cntr = 0
	while a <= n and b <= n:
		(a, b) = (b, a + b)
		cntr += 1
	return cntr
t = read_int()
for case in range(t):
	(a, b, n) = read_ints()
	sol = solve(a, b, n)
	print(sol)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	ct = 0
	while max(a, b) <= n:
		ax = min(a, b)
		ay = max(a, b)
		ax += ay
		a = ax
		b = ay
		ct += 1
	print(ct)


def foo(a, b, n):
	i = 0
	(a, b) = (min(a, b), max(a, b))
	while a <= n and b <= n:
		a += b
		(a, b) = (min(a, b), max(a, b))
		i += 1
	return i
T = int(input())
for i in range(T):
	bits = [int(i) for i in input().split()]
	(a, b, n) = (bits[0], bits[1], bits[2])
	print(foo(a, b, n))


t = int(input())
o = 0
m = 0
ma = 0
for i in range(t):
	(a, b, n) = map(int, input().split())
	while b <= n and a <= n:
		o += 1
		m = min(a, b)
		ma = max(a, b)
		m += ma
		a = m
		b = ma
	print(o)
	o = 0


t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	steps = 0
	while True:
		(a, b) = (a + b, max(a, b))
		steps += 1
		if a > n:
			break
	print(steps)


for _ in range(int(input())):
	(a, b, n) = map(int, input().strip().split()[:3])
	count = 0
	while True:
		if a == min(a, b):
			a += b
		else:
			b += a
		count += 1
		if a > n or b > n:
			break
	print(count)


def fib_to(a, b, n):
	fib = [min(a, b), max(a, b)]
	count = 0
	while True:
		fib[count % 2] = fib[-1] + fib[-2]
		count += 1
		if max(fib) > n:
			break
	return count
t = int(input())
while t > 0:
	t -= 1
	(a, b, n) = map(int, input().split())
	print(fib_to(a, b, n))


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi
import string as st
import heapq

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def main():
	try:
		(a, b, n) = In()
		if a > b:
			(a, b) = (b, a)
		q = 1
		total = 0
		while max(a, b) <= n:
			if q == 0:
				b += a
				q = 1
			else:
				a += b
				q = 0
			total += 1
		print(total)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	i = 0
	Max = max(a, b)
	Min = min(a, b)
	sum = Max
	while Min <= n and Max <= n:
		if Min < Max:
			Min = Min + Max
		else:
			Max = Max + Min
		i = i + 1
	print(i)
	t = t - 1


import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, stdin.readline().split())
	if a > b:
		(a, b) = (b, a)
	ans = 0
	doa = True
	while a <= n and b <= n:
		if doa:
			a += b
			doa = False
		else:
			b += a
			doa = True
		ans += 1
	print(ans)


T = int(input())
while T > 0:
	(a, b, n) = map(int, input().split())
	operation = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		operation += 1
	print(operation)
	T -= 1


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	(a, b, N) = map(int, readline().split())
	cnt = 0
	while max(a, b) <= N:
		cnt += 1
		if a > b:
			(a, b) = (b, a)
		a += b
	Ans[qu] = cnt
print('\n'.join(map(str, Ans)))


a = int(input())
for i in range(0, a):
	(a, b, n) = map(int, input().split())
	count = 0
	prev1 = max(a, b)
	prev2 = min(a, b)
	ans = max(a, b)
	while ans <= n:
		ans = prev1 + prev2
		count = count + 1
		prev2 = prev1
		prev1 = ans
	print(count)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	if a > b:
		maxi = a
		mini = b
	else:
		maxi = b
		mini = a
	c = 0
	while mini <= n and maxi <= n:
		if mini > maxi:
			maxi += mini
		else:
			mini += maxi
		c += 1
	print(c)


def count(a, b, n):
	if a > n or b > n:
		return 0
	elif a > b:
		return 1 + count(a, b + a, n)
	else:
		return 1 + count(a + b, b, n)
t = int(input())
values = list()
result = list()
for test_case in range(t):
	values = input()
	values = values.split()
	values = list(map(int, values))
	result.append(count(values[0], values[1], values[2]))
for i in result:
	print(i)


import math
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	count = 0
	x = min(a, b)
	while max(a, b) <= n:
		if min(a, b) == a:
			a = a + b
		else:
			b += a
		count += 1
	print(count)


def solve(a, b, n):
	count = 0
	while not (a > n or b > n):
		count += 1
		if a > b:
			b += a
		else:
			a += b
	return count
assert solve(1, 2, 3) == 2
assert solve(5, 4, 100) == 7

def main():
	T = int(input())
	for _ in range(T):
		(a, b, n) = map(int, input().split(' '))
		print(solve(a, b, n))
main()


t = int(input())
for case in range(t):
	(a, b, n) = list(map(int, input().split()))
	count = 0
	while a <= n and b <= n:
		mini = min(a, b)
		maxi = max(a, b)
		mini += maxi
		a = mini
		b = maxi
		count += 1
	print(count)


import math

def dtod(a):
	s = ''
	while a != 0:
		s += str(a % 2)
		a = int(a / 2)
	return s[::-1]
q = int(input())
for qw in range(q):
	s = input().split(' ')
	a = int(s[0])
	b = int(s[1])
	n = int(s[2])
	o = 0
	while (a > n or b > n) == False:
		if a < b:
			a += b
		else:
			b += a
		o += 1
	print(o)


def fun(a, b, k):
	sum = a + b
	count = 1
	while sum <= k:
		b = max(a, b)
		a = sum
		sum = sum + b
		count = count + 1
	return count
for i in range(0, int(input())):
	(a, b, k) = [int(x) for x in input().split()]
	print(fun(a, b, k))


t = int(input())
while t:
	(a, b, n) = [int(x) for x in input().split()]
	if a + b > n:
		print(1)
	else:
		tmp1 = min(a, b)
		tmp2 = max(a, b)
		ans = 0
		while tmp2 <= n:
			tmp1 += tmp2
			ans += 1
			if tmp1 > n:
				break
			tmp2 += tmp1
			ans += 1
		print(ans)
	t -= 1


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
for _ in range(int(ri())):
	(a, b, n) = Ri()
	if a < b:
		(a, b) = (b, a)
	cnt = 0
	while a <= n and b <= n:
		cnt += 1
		ta = a + b
		tb = max(a, b)
		a = ta
		b = tb
	print(cnt)


T = int(input())

def function(a, b, n):
	count = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		count += 1
	return count
for case in range(T):
	(a, b, n) = map(int, input().split())
	print(function(a, b, n))


for _ in range(int(input())):
	(a, b, n) = map(int, input().strip().split(' '))
	ans = 0
	while a <= n and b <= n:
		ans += 1
		if a < b:
			a += b
		else:
			b += a
	print(ans)


for ad in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	c = 0
	x = max(a, b)
	y = min(a, b)
	p = x
	q = y
	while (x <= n and y <= n) and (p <= n and q <= n):
		if c % 2 == 0:
			x += y
			q += p
		else:
			y += x
			p += q
		c += 1
	print(c)


t = int(input())
for i in range(t):
	count = 0
	(a, b, n) = map(int, input().split())
	larger = max(a, b)
	smaller = min(a, b)
	while larger <= n:
		count += 1
		(larger, smaller) = (larger + smaller, larger)
	print(count)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	aa = a
	bb = b
	i = 0
	while a <= n and b <= n and (aa <= n) and (bb <= n):
		if i % 2 == 0:
			a += b
			bb += aa
		else:
			b += a
			aa += bb
		i += 1
	print(i)


import sys
input = sys.stdin.readline

def main():
	for T in range(int(input())):
		(a, b, n) = map(int, input().split())
		if a < b:
			(a, b) = (b, a)
		k = 0
		while a <= n and b <= n:
			k += 1
			(b, a) = (a, a + b)
		print(k)
main()


t = int(input())
lis = []
out = []
for i in range(t):
	lis.append([int(i) for i in input().split()])
	if lis[i][0] > lis[i][1]:
		(min, max) = (lis[i][1], lis[i][0])
	else:
		(max, min) = (lis[i][1], lis[i][0])
	count = 0
	while min <= lis[i][2]:
		min += max
		count += 1
		(min, max) = (max, min)
	out.append(count - 1)
for i in out:
	print(i)


import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
T = int(input())
for _ in range(T):
	(A, B, N) = map(int, input().split())
	if A > B:
		(A, B) = (B, A)
	for i in range(1, 100000):
		A += B
		if A > N:
			print(i)
			break
		(A, B) = (B, A)


for x in range(int(input())):
	(a, b, c) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans = 0
	while b <= c:
		a += b
		ans += 1
		if a > c:
			break
		b += a
		ans += 1
	print(ans)


def main():
	t = int(input())
	for i in range(t):
		(a, b, n) = map(int, input().split())
		counter = 0
		while a <= n and b <= n:
			if a >= b or b + a > n:
				b += a
			else:
				a += b
			counter += 1
		print(counter)
main()


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	cnt = 0
	c = 0
	if a > n or b > n:
		print(0)
		continue
	(a, b) = (min(a, b), max(a, b))
	while c <= n:
		c = a + b
		a = b
		b = c
		cnt += 1
	print(cnt)


import math
t = int(input())
for i in range(t):
	(a, b, n) = [int(i) for i in input().split()]
	mn = min(a, b)
	mx = max(a, b)
	ans = 0
	while mx <= n:
		mn += mx
		temp = mn
		mn = mx
		mx = temp
		ans += 1
	print(ans)


T = int(input())
for _ in range(T):
	(a, b, n) = map(int, input().split())
	cnt = 0
	answer = 0
	while answer <= n:
		cnt += 1
		if a > b:
			b += a
			answer = b
		else:
			a += b
			answer = a
	print(cnt)


t = int(input())
F = [0] * 1000
F[0] = 1
F[1] = 1
for i in range(2, 1000):
	F[i] = F[i - 1] + F[i - 2]
for _ in range(t):
	(a, b, n) = map(int, input().split())
	(x, y) = (min(a, b), max(a, b))
	for i in range(1, 1000):
		if F[i] * y + F[i - 1] * x > n:
			print(i)
			break


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while 1:
		if a > n or b > n:
			print(cnt)
			break
		if a > b:
			b = a + b
		elif b > a:
			a = a + b
		elif a == b:
			a = a + b
		cnt = cnt + 1


cases = int(input())
for i in range(cases):
	line1 = input().split(' ')
	a = int(line1[0])
	b = int(line1[1])
	n = int(line1[2])
	c = 0
	while max(a, b) <= n:
		m1 = min(a, b)
		if a == m1:
			a += b
			c += 1
		elif b == m1:
			b += a
			c += 1
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	if a > n or b > n:
		print(0)
		continue
	k = 1
	f1 = 1
	f2 = 1
	cnt = 1
	while f1 * a + f2 * b <= n:
		t1 = f1
		t2 = f2
		f2 = t1
		f1 = t1 + t2
		cnt += 1
	print(cnt)


import sys
t = int(sys.stdin.readline())
while t:
	(a, b, n) = map(int, sys.stdin.readline().strip().split())
	count = 0
	(a, b) = sorted([a, b])
	i = 0
	while a <= n and b <= n:
		if i % 2 == 0:
			a += b
		else:
			b += a
		count += 1
		i += 1
	print(count)
	t -= 1


for tt in range(int(input())):
	(a, b, n) = map(int, input().split())
	ops = 0
	while a <= n and b <= n:
		ops += 1
		if a < b:
			a += b
		else:
			b += a
	print(ops)


def tran(arr):
	a = arr[0]
	b = arr[1]
	n = arr[2]
	if a < b:
		(a, b) = (b, a)
	c = 0
	while a <= n and b <= n:
		if a > b:
			b = a + b
			c = c + 1
		else:
			a = a + b
			c = c + 1
	return c
t = int(input())
ans = []
for i in range(t):
	arr = list(map(int, input().rstrip().split()))
	r = tran(arr)
	ans.append(r)
for i in ans:
	print(i)


from sys import stdin, stdout
int_in = lambda : int(stdin.readline())
arr_in = lambda : [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda : stdin.readline().strip()
out = lambda o: stdout.write('{}\n'.format(o))
arr_out = lambda o: out(' '.join(map(str, o)))
bool_out = lambda o: out('YES' if o else 'NO')
tests = lambda : range(1, int_in() + 1)
case_out = lambda i, o: out('Case #{}: {}'.format(i, o))

def solve(a, b, n):
	ops = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		ops += 1
	return ops
for i in tests():
	(a, b, n) = arr_in()
	out(solve(a, b, n))


from sys import stdin
from math import ceil, gcd

def func():
	return
for _ in range(int(stdin.readline())):
	(a, b, n) = map(int, stdin.readline().split())
	x = min(a, b)
	y = max(a, b)
	count = 0
	while x <= n and y <= n:
		if count % 2 == 0:
			x += y
		else:
			y += x
		count += 1
	print(count)


def model_acc(a, b, n):
	result = 0
	if a < b:
		(a, b) = (b, a)
	while a <= n:
		(a, b) = (a + b, a)
		result += 1
	return result
for _ in range(int(input())):
	print(model_acc(*map(int, input().split())))


for kl in range(int(input())):
	(x, y, z) = [int(x) for x in input().split()]
	c = 0
	for i in range(500):
		k = z / x
		l = z / y
		if k < l:
			y += x
		else:
			x += y
		c += 1
		if x > z or y > z:
			break
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	w = 0
	while a <= n or b <= n:
		if a > n or b > n:
			break
		w += 1
		if a <= b:
			a += b
		else:
			b += a
	print(w)


T = int(input())
for i in range(T):
	(a, b, n) = [int(x) for x in input().split()]
	(_min, _max) = (min(a, b), max(a, b))
	count = 1
	while _min + _max <= n:
		(_min, _max) = (_max, _min + _max)
		count += 1
	print(count)


def count(a, b, n, c):
	if a > n or b > n:
		return 1
	if a > b:
		b += a
		c = 1 + count(a, b, n, c)
	else:
		a += b
		c = 1 + count(a, b, n, c)
	return c
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	x = count(a, b, n, 0)
	print(x - 1)


for t in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	c = 0
	while True:
		c += 1
		if c % 2 != 0:
			a += b
			if a > n:
				break
		else:
			b += a
			if b > n:
				break
	print(c)


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = r = 0
	if a >= b:
		g = a
		s = b
	else:
		g = b
		s = a
	while r <= n:
		s = s + g
		r = s
		c = c + 1
		if r > n:
			break
		g = s + g
		r = g
		c = c + 1
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	i = 0
	if a > b:
		t = a
		a = b
		b = t
	while a <= n or b <= n:
		if a <= n:
			a += b
			i += 1
		if b <= n:
			b += a
			i += 1
	print(i - 1)


n = input()
n = int(n)
for i in range(n):
	c = input()
	c = c.split()
	a = int(c[0])
	b = int(c[1])
	n1 = int(c[2])
	j = 0
	while True:
		if (a > n1) | (b > n1):
			break
		elif a > b:
			b = b + a
		else:
			a = a + b
		j = j + 1
	print(j)


t = int(input())
while t > 0:
	(a, b, c) = map(int, input().split())
	if a < b:
		temp = a
		a = b
		b = temp
	term = 0
	while b <= c and a <= c:
		if term % 2 == 0:
			b = b + a
		else:
			a = a + b
		term += 1
	print(term)
	t -= 1


import math
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	ans = 0
	c = 0
	(a, b) = (max(a, b), min(a, b))
	while c <= n:
		c = a + b
		b = a
		a = c
		ans += 1
	print(ans)


t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	ans = 0
	tmp = max(a, b)
	b = min(a, b)
	a = tmp
	while max(a, b) <= n:
		b = b + a
		(a, b) = (b, a)
		ans += 1
	print(ans)


for i in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	(s, c) = (min(a, b), 1)
	s += max(a, b)
	if a < b:
		a = s
	else:
		b = s
	while s <= n:
		c += 1
		s += min(a, b)
		if a < b:
			a = s
		else:
			b = s
	print(str(c))


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	s = min(a, b)
	m = max(a, b)
	count = 0
	while m <= n:
		s += m
		count += 1
		if s <= n:
			m += s
			count += 1
		else:
			break
	print(count)


test_cases = int(input())
for e in range(test_cases):
	(a, b, n) = map(int, input().split())
	soma = 0
	while n >= a and n >= b:
		if a > b:
			b += a
			soma += 1
		else:
			a += b
			soma += 1
	print(soma)


for _ in range(int(input())):
	L = list(map(int, input().split()))
	a = L[0]
	b = L[1]
	R = 0
	n = L[2]
	s = 0
	while s <= n:
		if a < b:
			a += b
			R = R + 1
			s = a
		else:
			b += a
			R = R + 1
			s = b
	print(R)


import sys
from math import sqrt
input = sys.stdin.readline

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	t = inp()
	for l in range(t):
		(a, b, n) = invr()
		ans = 0
		while b <= n and a <= n:
			if a > b:
				b += a
			else:
				a += b
			ans += 1
		print(ans)
main()


t = int(input())
while t:
	line = input().split()
	(a, b, n) = (int(line[0]), int(line[1]), int(line[2]))
	if a > b:
		(a, b) = (b, a)
	cnt = 0
	while b <= n:
		cnt += 1
		c = a + b
		a = b
		b = c
	print(cnt)
	t -= 1


import sys
import math

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(a, b, n) = get_ints()
	c = min(a, b)
	d = max(a, b)
	count = 0
	while 1:
		if count % 2 == 0:
			c = c + d
			count = count + 1
		else:
			d = d + c
			count = count + 1
		if c > n or d > n:
			break
	print(count)


import io
import os
from collections import Counter, defaultdict, deque

def solve(A, B, N):
	if A > B:
		(A, B) = (B, A)
	steps = 0
	while A <= N and B <= N:
		A += B
		(A, B) = (B, A)
		steps += 1
	return steps
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(A, B, N) = [int(x) for x in input().split()]
	ans = solve(A, B, N)
	print(ans)


T = int(input())
for i in range(T):
	(a, b, n) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	count = 0
	while True:
		if count % 2 == 0:
			x += y
			if max(x, y) <= n:
				count += 1
			elif max(x, y) > n:
				count += 1
				break
		elif count % 2 != 0:
			y += x
			if max(x, y) <= n:
				count += 1
			elif max(x, y) > n:
				count += 1
				break
	print(count)


def solve():
	[a, b, n] = [int(x) for x in input().split()]
	small = big = -1
	if a >= b:
		big = a
		small = b
	else:
		big = b
		small = a
	ans = -1
	while big <= n or small <= n:
		ans += 1
		if ans % 2 == 0:
			small += big
		else:
			big += small
	return ans

def main():
	n = int(input())
	while n > 0:
		print(solve())
		n -= 1
main()


n = int(input())
while n > 0:
	n -= 1
	(a, b, c) = list(map(int, input().split(' ')))
	result = 0
	while a <= c and b <= c:
		if a > b:
			b += a
		else:
			a += b
		result += 1
	print(result)


m = int(input())
for i in range(m):
	d = 0
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	while b <= n:
		t = a + b
		(a, b) = (b, t)
		d += 1
	print(d)


t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	if a > b:
		l = a
		s = b
	else:
		l = b
		s = a
	c = 0
	while l <= n:
		z = l
		l = l + s
		s = z
		c += 1
	print(c)
	t = t - 1


from bisect import *
from collections import *
from math import *
from heapq import *
from typing import List
from itertools import *
from operator import *
from functools import *

@lru_cache(None)
def fact(x):
	if x < 2:
		return 1
	return fact(x - 1) * x

@lru_cache(None)
def per(i, j):
	return fact(i) // fact(i - j)

@lru_cache(None)
def com(i, j):
	return per(i, j) // fact(j)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def power2(n):
	while not n & 1:
		n >>= 1
	return n == 1
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	ans = 0
	while b <= n:
		(a, b) = (b, a + b)
		ans += 1
	print(ans)


import sys
inpy = [int(x) for x in sys.stdin.read().split()]
t = inpy[0]
for _i in range(t):
	(a, b, n) = inpy[_i * 3 + 1:_i * 3 + 4]
	s = 0
	while a <= n and b <= n:
		(a, b) = (a + b, max(a, b))
		s += 1
	print(s)


import math

def primeFactors(n):
	dic = set([n])
	while n % 2 == 0:
		dic.add(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			dic.add(i)
			n = n / i
	if n > 2:
		dic.add(n)
	return sorted(list(dic))

def twoStacks(x, a, b):
	a = [0] + a
	indexA = 0
	for i in range(1, len(a)):
		a[i] += a[i - 1]
		if a[i] <= x:
			indexA = i
		else:
			break
	for i in range(1, len(b)):
		b[i] += b[i - 1]
	indexB = 0
	ans = 0
	for i in range(indexA, -1, -1):
		sum = a[i]
		t = i
		secIndex = -1
		j = 0
		for j in range(indexB, len(b)):
			if sum + b[j] <= x:
				secIndex = j
			else:
				break
		t += secIndex + 1
		indexB = j
		if t > ans:
			ans = t
	return ans
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	maxV = max(a, b)
	minV = min(a, b)
	ans = 0
	while maxV <= n:
		minV += maxV
		if minV > maxV:
			(maxV, minV) = (minV, maxV)
		ans += 1
	print(ans)


t = int(input())
while t != 0:
	t -= 1
	(a, b, n) = [int(x) for x in input().split()]
	ans = [min(a, b), max(a, b)]
	ctr = 0
	i = 1
	while ans[-1] <= n:
		ans.append(ans[i] + ans[i - 1])
		i += 1
		ctr += 1
	print(ctr)


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 0
	flag = True
	while flag:
		if a <= b:
			a = a + b
		else:
			b = b + a
		ans = ans + 1
		if a > c or b > c:
			flag = False
			break
	print(ans)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	(a, b, n) = sorted(li())
	tot = 0
	while max(a, b) <= n:
		a += b
		(a, b) = sorted([a, b])
		tot += 1
	print(tot)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	t = 0
	aa = max(a, b)
	bb = min(a, b)
	while aa <= c and bb <= c:
		bb += aa
		t += 1
		if bb <= c:
			aa += bb
			t += 1
	print(t)


def operation(a, b, n):
	total = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		total += 1
	return total

def get_tests(t):
	result = []
	while t > 0:
		(a, b, n) = input().split(' ')
		result.append([int(a), int(b), int(n)])
		t -= 1
	return result

def test_queries(tests):
	result = []
	for test in tests:
		(a, b, n) = test
		result.append(operation(a, b, n))
	return result
tests = get_tests(int(input()))
res = test_queries(tests)
for r in res:
	print(r)


t = int(input())
results = list()
for k in range(0, t):
	(a, b, n) = map(int, input().split(' '))
	operations = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		operations += 1
	results.append(operations)
for result in results:
	print(result)


for case in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	(a, b) = [min(a, b), max(a, b)]
	c = 0
	while max(a, b) <= n:
		(a, b) = [max(a, b), a + b]
		c += 1
	print(c)


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	(a, b, c) = invr()
	move = 0
	while a <= c and b <= c:
		if a > b:
			(a, b) = (b, a)
		a += b
		move += 1
	print(move)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from math import gcd
from bisect import bisect

def solution():
	t = int(input())
	for _ in range(t):
		cnt = 0
		(a, b, n) = map(int, input().split())
		while a <= n and b <= n:
			e = max(a, b)
			(a, b) = (a + b, e)
			cnt += 1
		print(cnt)
solution()
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
read = lambda : list(map(int, input().strip().split(' ')))


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	ctr = 0
	while max(a, b) <= n:
		ctr += 1
		if min(a, b) == a:
			a += b
		elif min(a, b) == b:
			b += a
	print(ctr)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split(' '))
	movesa = 0
	movesb = 0
	if a >= b:
		while a <= n:
			b += a
			movesa += 1
			if b > n:
				break
			else:
				val = a + b
				if val > n:
					movesa += 1
					break
				else:
					a += b
					movesa += 1
	else:
		while b <= n:
			a += b
			movesb += 1
			if a > n:
				break
			else:
				val = b + a
				if val > n:
					movesb += 1
					break
				else:
					b += a
					movesb += 1
	print(max(movesa, movesb))


import os

def readlist(src):
	return src.readline().split()
test_file = 'test.txt'
src = open(test_file) if os.path.isfile(test_file) else os.sys.stdin

def solve(a, b, n, step=0):
	if b > n:
		return step
	else:
		return solve(b, a + b, n, step + 1)
n = src.readline()
for _ in range(int(n)):
	(a, b, n) = readlist(src)
	(a, b, n) = (int(a), int(b), int(n))
	print(solve(min(a, b), max(a, b), n))


t = int(input())
ls1 = []
for i in range(t):
	temp = list(map(int, input().split()))
	ls1.append(temp)
ans_ls = []
for i in ls1:
	count = 0
	while i[0] <= i[2] and i[1] <= i[2]:
		if i[0] >= i[1]:
			i[1] += i[0]
		else:
			i[0] += i[1]
		count += 1
	ans_ls.append(count)
for i in ans_ls:
	print(i)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	(x, y) = (1, 1)
	ans = 1
	while a * x + b * y <= n:
		ans += 1
		temp = x
		x += y
		y = temp
	print(ans)


import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
T = int(readline())

def solve():
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	c = 0
	while b <= n:
		c += 1
		(a, b) = (b, a + b)
	return c
ans = []
for i in range(1, T + 1):
	t = solve()
	ans.append(t)
print('\n'.join(map(str, ans)))


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	f = a
	s = a + b
	if f > n:
		print(0)
	elif s > n:
		print(1)
	else:
		cnt = 2
		while True:
			if f > n:
				print(cnt - 2)
				break
			elif s > n:
				print(cnt - 1)
				break
			f = s + f
			s = s + f
			cnt += 2


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	ans = 0
	while n >= a and n >= b:
		b += a
		ans += 1
		if b > n:
			break
		if b + a > n:
			ans += 1
			break
		a += b
		ans += 1
	print(ans)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	i = 0
	if a > b:
		(b, a) = (a, b)
	while True:
		a += b
		if a > n:
			print(i + 1)
			break
		b += a
		if b > n:
			print(i + 2)
			break
		i += 2


PUTIN_HELP_ME = not None
NAVALNY_HELP_ME = not None
DURKA_HELP_ME = not None
import sys, os, re
from math import *
from random import *

class Answer(BaseException):

	def __init__(self, txt):
		self.__text = txt

	def what(self):
		return self.__text

def answer(arg):
	raise Answer

def lcm(a, b: int):
	return a * b // gcd(a, b)

def readArr(modifier=int):
	return list(map(modifier, input().split()))

def rA(m=int):
	return readArr(m)

def chomp(s: str):
	return s[:-1] if s[-1] == '\n' else s

def readFile(name: str):
	f = open(name, 'r')
	r = f.readlines()
	f.close()
	return r

def init_all():
	sys.setrecursionlimit(max(sys.getrecursionlimit(), 500000))

def lower_bound(a, k):
	(l, r) = (0, len(a) - 1)
	while l != r:
		mid = (l + r) // 2
		if a[mid] < k:
			l = mid + 1
		else:
			r = mid
	return l

def upper_bound(a, k):
	(l, r) = (0, len(a) - 1)
	while l + 1 < r:
		mid = (l + r) // 2
		if a[mid] <= k:
			l = mid
		else:
			r = mid - 1
	if a[r] == k:
		return r
	else:
		return l

class poly_hash:

	def __init__(self, s):
		self.seed = 228
		self.M = 1000000007
		self.n = len(s)
		self.pows = [1]
		self.hsh = [0 for _ in range(self.n + 1)]
		for _ in range(self.n):
			self.pows.append(self.pows[-1] * self.seed % self.M)
		for i in range(self.n):
			self.hsh[i + 1] = (self.hsh[i] * self.seed + s[i]) % self.M

	def sub_hash(self, l, r):
		return (self.hsh[r] - self.hsh[l] * self.pows[r - l]) % self.M

def pre_func(s):
	p = [0]
	a = 0
	for i in range(1, len(s)):
		while a > 0 and s[i] != s[a]:
			a = p[a - 1]
		if s[i] == s[a]:
			a += 1
		p.append(a)
	return p

def solve():
	(a, b, n) = readArr()
	if a > b:
		(a, b) = (b, a)
	ans = 0
	while max(a, b) <= n:
		ans += 1
		a += b
		(a, b) = (b, a)
	print(ans)

def main(argv: list):
	init_all()
	t = 1
	t = int(input())
	for _ in range(t):
		try:
			solve()
		except Answer as a:
			print(a.what())
	return 0
exit(main(sys.argv))


x = int(input())
for t in range(x):
	(a, b, n) = map(int, input().split())
	count = 1
	ans = 0
	if a >= b:
		while True:
			if count % 2 != 0:
				b += a
				ans += 1
				count += 1
			else:
				a += b
				ans += 1
				count += 1
			if a > n or b > n:
				break
	elif a < b:
		while True:
			if count % 2 != 0:
				a += b
				ans += 1
				count += 1
			else:
				b += a
				ans += 1
				count += 1
			if a > n or b > n:
				break
	print(ans)


import sys
import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)
M = 10 ** 9 + 7
T = int(stdin.readline())
a = [0, 1]
for i in range(50):
	a.append(a[-1] + a[-2])
b = [1, 1]
for i in range(50):
	b.append(b[-1] + b[-2])
for _ in range(T):
	(x, y, n) = list(map(int, stdin.readline().split()))
	A = min(x, y)
	B = max(x, y)
	for i in range(52):
		if A * a[i] + B * b[i] > n:
			print(i)
			break


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	if a + b > n:
		print(1)
	else:
		i = 1
		j = 1
		s = 0
		c = 0
		while True:
			s = j * a + i * b
			(i, j) = (j, i + j)
			c += 1
			if s > n:
				break
		print(c)


try:
	T = int(input())
	for _ in range(T):
		A_list = list(map(int, input().split()))
		A = A_list[0]
		B = A_list[1]
		C = A_list[2]
		count = 0
		while A <= C and B <= C:
			if A < B:
				A += B
				count += 1
			else:
				B += A
				count += 1
		print(count)
except EOFError:
	pass


t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	m = min(a, b)
	i = 0
	oper = 0
	if m == a:
		while a <= n and b <= n:
			a += b
			oper += 1
			if a > n:
				break
			b += a
			oper += 1
	else:
		while a <= n and b <= n:
			b += a
			oper += 1
			if b > n:
				break
			a += b
			oper += 1
	print(oper)
	t -= 1


import sys, math, cmath, time
start_time = time.time()

def solve():
	(a, b, n) = invr()
	q = 0
	if a > b:
		(a, b) = (b, a)
	if a <= n and b <= n:
		while True:
			c = b
			b = a + b
			a = c
			q = q + 1
			if b > n:
				break
	print(q)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


def process_test_case(i_t):
	(a, b, n) = map(int, input().split())
	ans = 0
	while max(a, b) <= n:
		if a <= b:
			(a, b) = (a + b, b)
		else:
			(a, b) = (a, a + b)
		ans += 1
	print(ans)
	return None
n_tests = int(input())
for i_test in range(1, n_tests + 1):
	process_test_case(i_test)


def f(a, b, n, o):
	if a > n or b > n:
		return o
	return f(max(a, b), a + b, n, o + 1)
for __ in range(int(input())):
	(a, b, n) = [int(_) for _ in input().split()]
	print(f(a, b, n, 0))


def find(a, b, n, num=0):
	if max(a, b) > n:
		return num
	return find(max(a, b), a + b, n, num + 1)

def main():
	(a, b, n) = [int(x) for x in input().split()]
	return find(a, b, n)
num_of_cases = [int(x) for x in input().split()][0]
for p in range(num_of_cases):
	output = main()
	print('{1}'.format(p + 1, output))


def solve(a, b, n):
	if a > b:
		(a, b) = (b, a)
	t = 0
	while a <= n and b <= n:
		(a, b) = (b, a + b)
		t += 1
	return t
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	print(solve(a, b, n))


n = input('')
n = int(n)
matrix = []
for i in range(n):
	C = input('')
	entries = list(map(int, C.split()))
	matrix.append(entries)
for j in matrix:
	a = j[0]
	b = j[1]
	n = j[2]
	cnt = 0
	if a < b:
		temp = a
		a = b
		b = temp
	while a <= n:
		temp = a
		a = a + b
		b = temp
		cnt = cnt + 1
	print(cnt)


T = int(input())
answer = list()
for i in range(T):
	(a, b, n) = [int(j) for j in input().split()]
	c = 0
	while max(a, b) <= n:
		if a > b:
			b += a
		else:
			a += b
		c += 1
	answer.append(str(c))
print('\n'.join(answer))


import os
from sys import stdin

def solve(tc):
	(a, b, n) = map(int, stdin.readline().split())
	if a > b:
		(a, b) = (b, a)
	if a + b > n:
		print(1)
		return
	cnt = 0
	while True:
		a += b
		cnt += 1
		if a > n:
			break
		b += a
		cnt += 1
		if b > n:
			break
	print(cnt)
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from collections import Counter
from bisect import bisect_left
import sys
from queue import PriorityQueue
mod = 1000000007

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())

def printIn(ob):
	return stdout.write(str(ob) + '\n')

def powerLL(n, p):
	result = 1
	while p:
		if p & 1:
			result = result * n % mod
		p = int(p / 2)
		n = n * n % mod
	return result

def myCode():
	(a, b, n) = In()
	ops = 0
	while max(a, b) <= n:
		ops += 1
		if a < b:
			a += b
		else:
			b += a
	print(ops)

def main():
	for t in range(I()):
		myCode()
main()


import sys, math
t = int(sys.stdin.readline())
for _ in range(t):
	(a, b, n) = map(int, sys.stdin.readline().split())
	out = 0
	while max(a, b) <= n:
		out += 1
		if a > b:
			b += a
		else:
			a += b
	print(out)


t = int(input())
for test in range(t):
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	if b > a:
		(a, b) = (b, a)
	c = 0
	while a <= n and b <= n:
		b += a
		(a, b) = (b, a)
		c += 1
	print(c)


from fractions import Fraction
from collections import defaultdict
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
krish = 1000
ans = krish - 900
res = ans - 10
t = int(input())
for _ in range(t):
	(a, b, n) = [int(x) for x in input().split()]
	s = 0
	c = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		c += 1
		res += 1
	print(c)


try:
	t = int(input())
	for i in range(t):
		(a, b, n) = map(int, input().split())
		cnt = 0
		s = a + b
		while s <= n:
			if a < b:
				a = s
			else:
				b = s
			cnt += 1
			s = a + b
		print(cnt + 1)
except:
	pass


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	if a < b:
		(l, i) = (0, 0)
	else:
		(l, i) = (1, 1)
	while a <= n and b <= n:
		i += 1
		if i % 2:
			a += b
		else:
			b += a
	if l:
		print(i - 1)
	else:
		print(i)


import sys
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

def solve():
	(a, b, n) = I()
	ans = 0
	while a <= n and b <= n:
		if a + b > n:
			ans += 1
			break
		(a, b) = (min(a, b), max(a, b))
		a += b
		ans += 1
	print(ans)
(t,) = I()
while t:
	t -= 1
	solve()


t = int(input())
while t:
	t = t - 1
	(a, b, n) = map(int, input().split())
	k = 1
	while a + b <= n:
		if a >= b:
			b = a + b
		else:
			a = a + b
		k = k + 1
	print(k)


ni = int(input())
for ti in range(ni):
	(a, b, n) = map(int, input().split())
	nos = 0
	while a <= n or b <= n:
		if b < a:
			b += a
		else:
			a += b
		nos += 1
	print(nos - 1)


test_cases = int(input())
for _ in range(test_cases):
	(a, b, z) = map(int, input().split())
	count = 0
	while a <= z and b <= z:
		if min(a, b) == a:
			a += b
		else:
			b += a
		count += 1
	print(count)


T = int(input())
a = []
for i in range(T):
	a.append(input())
arr = []
k = 0
for i in a:
	splited = i.split()
	a = int(splited[0])
	b = int(splited[1])
	n = int(splited[2])
	while a <= n and b <= n:
		if a < b:
			a += b
			k += 1
		else:
			b += a
			k += 1
	arr.append(k)
	k = 0
for i in arr:
	print(i)


def operation(k, l, m):
	if k > m or l > m:
		return 0
	return 1 + operation(max(k, l), k + l, m)
testes = int(input())
for i in range(testes):
	entrada = input().split()
	a = int(entrada[0])
	b = int(entrada[1])
	n = int(entrada[2])
	print(operation(a, b, n))


def main():
	T = int(input())
	list_a = []
	for i in range(T):
		(a, b, n) = input().split()
		list_a.append([int(a), int(b), int(n)])
	for i in range(len(list_a)):
		counter = 0
		a = list_a[i][0]
		b = list_a[i][1]
		n = list_a[i][2]
		while a <= n and b <= n:
			if a <= b:
				a += b
			else:
				b += a
			counter += 1
		print(counter)
main()


import sys
input = sys.stdin.buffer.readline

def solution():
	for _ in range(int(input())):
		(a, b, n) = map(int, input().split())
		cnt = 0
		while a <= n and b <= n:
			if a < b:
				a += b
			else:
				b += a
			cnt += 1
		print(cnt)
solution()


t = int(input())

def calculate_num_operations(a, b, n):
	if a > n or b > n:
		return 0
	return 1 + calculate_num_operations(max(a, b), a + b, n)
for _ in range(t):
	(a, b, n) = list(map(lambda number: int(number), input().split(' ')))
	print(calculate_num_operations(a, b, n))


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	sm = 0
	ma = max(a, b)
	mi = min(a, b)
	count = 0
	while ma <= n:
		mio = mi
		mi = ma
		ma = ma + mio
		count = count + 1
	print(count)


import sys
import bisect as b
import math
from collections import defaultdict as dd
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def pref(a, n):
	pre = [0] * n
	pre[0] = a[0]
	for i in range(1, n):
		pre[i] = a[i] + pre[i - 1]
	return pre
FibArray = [0, 1]

def fibonacci(n):
	if n < 0:
		print('Incorrect input')
	elif n <= len(FibArray):
		return FibArray[n - 1]
	else:
		temp_fib = fibonacci(n - 1) + fibonacci(n - 2)
		FibArray.append(temp_fib)
		return temp_fib
for _ in range(inin()):
	(a, b, n) = cin()
	if a > b:
		(a, b) = (b, a)
	l = fibonacci(500)
	l = FibArray
	c = 0
	for i in range(len(l)):
		if l[i] * a + l[i + 1] * b > n:
			break
		c += 1
	print(c)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	cnt = 0
	while a <= c and b <= c:
		if a <= b:
			a += b
			cnt += 1
		elif a >= b:
			b += a
			cnt += 1
	print(cnt)


for _ in range(int(input())):
	(x, y, n) = map(int, input().split())
	a = max(x, y)
	b = min(x, y)
	count = 0
	i = 1
	while a <= n and b <= n:
		if a >= b:
			b += a
		else:
			a += b
		count += 1
	print(count)


def solve():
	a = [int(i) for i in input().split()]
	x = 0
	while a[0] <= a[2] and a[1] <= a[2]:
		if a[1] > a[0]:
			a[0] += a[1]
			x += 1
			pass
		else:
			a[1] += a[0]
			x += 1
			pass
		pass
	print(x)
n = int(input())
for _ in range(n):
	solve()
	pass


import sys
inputr = lambda : sys.stdin.readline().rstrip('\n')
input = sys.stdin.readline
INF = 10 ** 18
for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	r = 0
	while a <= n and b <= n:
		r += 1
		if a > b:
			b += a
		else:
			a += b
	print(r)


for tc in range(int(input())):
	inp = input().split()
	a = max(int(inp[0]), int(inp[1]))
	b = min(int(inp[0]), int(inp[1]))
	n = int(inp[2])
	count = 0
	while max(a, b) <= n:
		x = min(a, b)
		y = max(a, b)
		x += y
		a = y
		b = x
		count += 1
	print(count)


test_cases = int(input())
for i in range(test_cases):
	(a, b, n) = map(int, input().split())
	operations = 0
	while a <= n and b <= n:
		if a > b:
			(a, b) = (a, a + b)
		else:
			(a, b) = (a + b, b)
		operations += 1
	print(operations)


def C(a, b, n):
	count = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	return count
Lista = []
total = int(input())
for i in range(total):
	All = [int(i) for i in input().split()]
	Lista.append(All)
for j in Lista:
	print(C(j[0], j[1], j[2]))


t = int(input())
for i in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	a = L[0]
	b = L[1]
	n = L[2]
	comp = 0
	while a <= n and b <= n:
		if a < b:
			a += b
			comp += 1
		else:
			b += a
			comp += 1
	print(comp)


def solve():
	(a, b, n) = map(int, input().split())
	c = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		c += 1
	print(c)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
while t:
	inp1 = list(map(int, input().strip().split()))[:3]
	(a, b, n) = (inp1[0], inp1[1], inp1[2])
	count = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	print(count)
	t -= 1


from math import ceil
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while a <= n and b <= n:
		if a < b:
			(a, b) = (b, a)
		b += a
		cnt += 1
	print(cnt)


from math import *

def main():
	t = int(input())
	for test in range(t):
		(a, b, n) = map(int, input().split())
		ans = -1
		while b <= n or a <= n:
			if min(a, b) == a:
				a += b
			else:
				b += a
			ans += 1
		print(ans)
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	count = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	print(count)


for i in [0] * int(input()):
	cnt = 0
	f = 1
	(a, b, c) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	while c >= x and c >= y:
		if f == 1:
			y += x
			cnt += 1
			f = 0
		else:
			x += y
			cnt += 1
			f = 1
	print(cnt)


from math import ceil

def func(a, b, n, cnt):
	if a > n or b > n:
		return cnt
	if a >= b:
		return func(a, b + a, n, cnt + 1)
	else:
		return func(a + b, b, n, cnt + 1)
N = int(input())
for _ in range(N):
	(ai, bi, ni) = map(int, input().split())
	print(func(ai, bi, ni, 0))


N = int(input())
for i in range(N):
	count = 0
	(a, b, m) = list(map(int, input().split()))
	while not a > m or not b > m:
		count += 1
		if a > b:
			b += a
		else:
			a += b
	print(count - 1)


for _ in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	k = min(a, b)
	m = max(a, b)
	cnt = 0
	while k <= n:
		k = k + m
		m = max(m, k - m)
		cnt += 1
	print(cnt)


tests = 1
ekkb = 1
tests = int(input())
while ekkb > 0:
	ekkb -= 1
	while tests > 0:
		tests -= 1
		(a, b, n) = map(int, input().split())
		c = 0
		f = 0
		if a > b:
			f = 0
		while a <= n and b <= n:
			if b > a:
				a += b
			else:
				b += a
			c += 1
			f ^= 1
			if a > n or b > n:
				break
		print(c)


def func():
	(a, b, n) = map(int, input().split())
	cnt = 0
	while a <= n and b <= n:
		large = a if a > b else b
		if a == large:
			b += a
		elif b == large:
			a += b
		cnt += 1
	print(cnt)

def main():
	for i in range(int(input())):
		func()
main()


def cp(a, b, n):
	m = min(a, b)
	x = max(a, b)
	c = 0
	s = 0
	while s <= n:
		if c % 2 == 0:
			m = m + x
			s = m
		else:
			x = x + m
			s = x
		c = c + 1
	print(c)
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split(' '))
	cp(a, b, n)


t = int(input())
for i in range(t):
	(a, b, c) = input().split()
	(a, b, c) = (int(a), int(b), int(c))
	count = 0
	(a, b) = (min(a, b), max(a, b))
	while b <= c:
		(a, b) = (b, a + b)
		count += 1
	print(count)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	count = 1
	c = a + b
	prev = max(a, b)
	while c <= n:
		d = c
		c = c + prev
		count += 1
		prev = d
	print(count)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if b > a:
		test = b
		b = a
		a = test
	x = 1
	y = 1
	steps = 0
	while True:
		sum = y * a + x * b
		steps += 1
		if sum > n:
			print(steps)
			break
		(x, y) = (y, x + y)


from sys import stdin, stdout
for query in range(int(stdin.readline())):
	abn = stdin.readline().split()
	a = int(abn[0])
	b = int(abn[1])
	n = int(abn[2])
	count = 0
	while a <= n and b <= n:
		count += 1
		if a < b:
			a += b
		else:
			b += a
	stdout.write(str(count) + '\n')


n = int(input(''))
i = 0
l = []
while i < n:
	i += 1
	e = input('')
	l.append(e)
for case in l:
	k = 0
	m = case.split()
	a = int(m[0])
	b = int(m[1])
	c = int(m[2])
	while a <= c and b <= c:
		k += 1
		if a < b:
			a += b
		else:
			b += a
	print(k)


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi, log
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
from functools import cmp_to_key, reduce
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007
ch = 'abcdefghijklmnopqrstuvwxyz'
lcm = lambda a, b: a * b // gcd(a, b)
setbit = lambda x: bin(x)[2:].count('1')
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def solve():
	T = int(input())
	for _ in range(T):
		(aa, bb, n) = map(int, input().split())
		c = 0
		s = 0
		(a, b) = (min(aa, bb), max(aa, bb))
		while s <= n:
			s = a + b
			a = b
			b = s
			c += 1
		print(c)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
solve()


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	Ans = 0
	while n <= k and m <= k:
		if n > m:
			m += n
		else:
			n += m
		Ans += 1
	print(Ans)


import sys
input = sys.stdin.readline
ans = []
for kek in range(int(input())):
	(a, b, n) = map(int, input().split())
	i = 0
	while a <= n or b <= n:
		i += 1
		(a, b) = (min(a, b), max(a, b))
		if b + a > n:
			ans.append(i)
			break
		else:
			a += b
print(*ans, sep='\n')


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().strip().split(' '))
	c = 0
	while a <= n:
		temp = a
		a += b
		c += 1
		b = max(temp, b)
	print(c)


T = int(input())
for case in range(T):
	(A, B, N) = input().split()
	A = int(A)
	B = int(B)
	N = int(N)
	temp = min(A, B)
	A = max(A, B)
	B = temp
	count = 0
	index = 0
	while A <= N and B <= N:
		index += 1
		count += 1
		if index % 2 == 1:
			B += A
		else:
			A += B
	print(count)


for _ in range(int(input())):
	(a, b, n) = (int(x) for x in input().split())
	if a > b:
		(a, b) = (b, a)
	ans = 0
	while True:
		if a > n or b > n:
			break
		a += b
		(a, b) = (b, a)
		ans += 1
	print(ans)


import math
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	act = math.ceil((n - b) / a)
	bct = math.ceil((n - a) / b)
	c = 0
	while max(a, b) <= n:
		if a == min(a, b):
			a += b
		elif b == min(a, b):
			b += a
		c += 1
	print(c)


t = int(input())
while t:
	t -= 1
	count = 0
	(a1, b1, c) = map(int, input().split())
	a = a1
	b = b1
	ans = 0
	count = 0
	while a < c:
		if a + b <= c:
			b += a
			count += 1
		a += b
		count += 1
	if a == c:
		count += 1
	a = a1
	b = b1
	ans = count
	count = 0
	while a < c:
		a += b
		count += 1
		if a + b <= c:
			b += a
			count += 1
	if a == c:
		count += 1
	print(min(ans, count))


t = int(input())
out = []
for i in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		c += 1
	out.append(c)
for ans in out:
	print(ans)


import sys
import math
import collections
import heapq

def set_debug(debug_mode=False):
	if debug_mode:
		fin = open('input.txt', 'r')
		sys.stdin = fin

def int_input():
	return list(map(int, input().split()))

def get(x):
	cur = 0
	mx = 0
	for i in range(1, len(s) + 1):
		cur += x * a[i]
		mx = max(mx, cur)
		if cur < 0:
			cur = 0
	return mx
t = int(input())
for ti in range(1, t + 1):
	(a, b, n) = int_input()
	(a, b) = (max(a, b), min(a, b))
	res = 0
	x = a
	while a <= n:
		(a, b) = (a + b, a)
		res += 1
	print(res)


t = int(input())
for _ in range(t):
	d = 1
	(a, b, c) = map(int, input().split())
	while a + b <= c:
		if a > b:
			b = b + a
		else:
			a = a + b
		d += 1
	print(d)


a = int(input())
for c in range(a):
	(s, d, f) = input().split()
	s = int(s)
	d = int(d)
	f = int(f)
	l = 0
	if d < s:
		(s, d) = (d, s)
	while s <= f and d <= f:
		if l % 2 == 0:
			s += d
		else:
			d += s
		l += 1
	print(l)


t = int(input())
for s in range(t):
	(a, b, n) = map(int, input().split())
	step = 0
	while True:
		if a > b:
			b += a
			step += 1
		else:
			a += b
			step += 1
		if a > n or b > n:
			print(step)
			break


t = int(input())
for i in range(t):
	vs = input().split()
	(a, b, n) = (int(vs[0]), int(vs[1]), int(vs[2]))
	poc = 0
	while max(a, b) <= n:
		poc += 1
		if a > b:
			b += a
		else:
			a += b
	print(poc)


from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	(a, b, n) = mapi()
	cnt = 0
	while a <= n and b <= n:
		(a, b) = (max(a, b), min(a, b))
		b += a
		cnt += 1
	print(cnt)


from sys import stdin
A = int(stdin.readline())
for t in range(0, A):
	B = list(map(int, stdin.readline().split()))
	a = B[0]
	b = B[1]
	n = B[2]
	key = max(a, b)
	key2 = min(a, b)
	count = 0
	K = 0
	while key <= n and key2 <= n:
		count += 1
		if K == 0:
			key2 += key
			K = 1
		else:
			key += key2
			K = 0
	print(count)


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	if a < b:
		(a, b) = (b, a)
	is_a = False
	ans = 0
	while a <= n and b <= n:
		if is_a:
			a += b
		else:
			b += a
		is_a = not is_a
		ans += 1
	print(ans)


T = int(input())
for t in range(0, T):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		cnt = cnt + 1
	print(cnt)


t = int(input())
b = [[0 for i in range(3)] for i in range(t)]
for i in range(t):
	b[i] = list(map(int, input().split()))
for i in range(t):
	m = max(b[i][0], b[i][1])
	n = min(b[i][0], b[i][1])
	add = 0
	while m <= b[i][2]:
		a = m
		m += n
		add += 1
		n = a
	print(add)


for _ in ' ' * int(input()):
	(a, b, c) = map(int, input().split())
	z = 1
	p = 0
	if max(a, b) > c:
		print(0)
		continue
	(a, b) = (min(a, b), max(a, b))
	while max(a, b) <= c:
		if z:
			a += b
			z = 0
		else:
			b += a
			z = 1
		p += 1
	print(p)


def find_min_op(a: int, b: int, n: int):
	count = 0
	while b <= n:
		(a, b) = (max(a, b), b + a)
		count += 1
	return count
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	no_of_ops = find_min_op(a, b, n)
	print(no_of_ops)


import sys
import os.path
import math
import copy
from sys import stdin, stdout
from collections import *
from math import gcd, ceil, floor
mod = int(1000000000.0 + 7)
m1 = float('inf')
if os.path.exists('Updated prg/Input3d.txt'):
	sys.stdout = open('Updated prg/Output3d.txt', 'w')
	sys.stdin = open('Updated prg/Input3d.txt', 'r')

def sinp():
	return input()

def ninp():
	return int(sinp())

def mapinp():
	return map(int, sinp().split())

def smapinp():
	return map(str, sinp().split())

def linp():
	return list(mapinp())

def sl():
	return list(sinp().split())

def power(n):
	return 1 << n

def prnt(a):
	print(a)

def prntl(a):
	print(a, end=' ')

def prntlist(l1):
	print(*l1)
for _ in range(ninp()):
	(a, b, n) = mapinp()
	c = 0
	while a <= n and b <= n:
		maxi = max(a, b)
		if maxi != a:
			a = a + b
			c = c + 1
		else:
			b = b + a
			c = c + 1
	prnt(c)


T = int(input())
for test in range(T):
	(a, b, n) = [int(x) for x in input().split(' ')]
	if n < max(a, b):
		print(0)
	else:
		total_operations = 0
		while max(a, b) <= n:
			(a, b) = (max(a, b), a + b)
			total_operations += 1
		print(total_operations)


def fun(a, b, n):
	if a < b:
		turn = 0
	else:
		turn = 1
	count = 0
	while a <= n and b <= n:
		if turn == 0:
			a += b
			turn = 1 - turn
			count += 1
		else:
			b += a
			turn = 1 - turn
			count += 1
	return count
for _ in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	print(fun(a, b, n))


test = int(input())
for _ in range(test):
	(a, b, n) = map(int, input().split())
	c = 0
	while True:
		if a > n:
			break
		elif b > n:
			break
		if a < b:
			a += b
			c += 1
		else:
			b += a
			c += 1
	print(c)


import math
t = int(input())
for you in range(t):
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	n = int(l[2])
	y = max(a, b)
	x = min(a, b)
	dp = [0 for i in range(100)]
	dp[0] = y
	if dp[0] > n:
		print(0)
		continue
	dp[1] = y + x
	if dp[1] > n:
		print(1)
		continue
	ans = 0
	for i in range(2, 1000):
		dp[i] = dp[i - 1] + dp[i - 2]
		if dp[i] > n:
			ans = i
			break
	print(ans)


from __future__ import division, print_function
import os, sys
import math
import collections
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(arr):
	return collections.Counter(arr)

def pos(a):
	b = [0] * len(a)
	c = sorted(a)
	for i in range(len(a)):
		for j in range(len(a)):
			if c[j] == a[i]:
				b[i] = j
				break
	return b

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def commonn(a, b, n):
	c = []
	for i in range(n):
		if a[i] == b[i]:
			c.append('-1')
		else:
			c.append(b[i])
	return c

def main():
	for _ in range(ii()):
		(a, b, n) = mi()
		if a > b:
			(b, a) = (a, b)
		a += b
		cou = 0
		for i in range(n):
			if max(a, b) > n:
				break
			if i % 2 == 0:
				b += a
				cou += 1
			else:
				a += b
				cou += 1
		print(cou + 1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
while t != 0:
	(a, b, n) = map(int, input().split())
	op = 0
	if b > a:
		(a, b) = (b, a)
	while a <= n and b <= n:
		b += a
		if b > a:
			(a, b) = (b, a)
		op += 1
	print(op)
	t -= 1


def calculate(a, b, n):
	count = 0
	while not (a > n or b > n):
		if a >= b:
			b += a
		else:
			a += b
		count += 1
	print(count)
test_cases = int(input())
for i in range(0, test_cases):
	inpt = input().split()
	calculate(int(inpt[0]), int(inpt[1]), int(inpt[2]))


def raf():
	(a, b, c) = map(int, input().split())
	i = 0
	t = b
	r = a
	while r <= c:
		(t, r) = (max(r, t), min(r, t))
		r += t
		i += 1
	print(i)

def main():
	t = int(input())
	while t != 0:
		raf()
		t -= 1
main()


import math
for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	if b > a:
		(a, b) = (b, a)
	st = 0
	f = 1
	s = 1
	while a * f + b * s <= n:
		d = s
		s = f
		f += d
		st += 1
	print(st + 1)


def solve():
	(a, b, n) = [int(x) for x in input().split()]
	if b > a:
		(a, b) = (b, a)
	ans = 0
	while a <= n:
		b += a
		(a, b) = (b, a)
		ans += 1
	print(ans)
t = int(input())
for _ in range(t):
	solve()


times = int(input())
limites = []
for i in range(times):
	varis = input().split()
	a = int(varis[0])
	b = int(varis[1])
	teto = int(varis[2])
	ope = 0
	while True:
		if a > b:
			b += a
			ope += 1
		else:
			a += b
			ope += 1
		if a > teto or b > teto:
			break
	limites.append(ope)
for e in limites:
	print(e)


from sys import stdin
fib = [0, 1]
while fib[-1] <= 10 ** 9:
	fib.append(fib[-1] + fib[-2])
for _ in range(int(stdin.readline())):
	(a, b, n) = map(int, stdin.readline().split())
	x = min(a, b)
	y = max(a, b)
	i = 0
	ans = y
	while ans <= n:
		i += 1
		ans = fib[i + 1] * y + fib[i] * x
	print(i)


t = int(input())
st = ''
for i in range(1, t + 1):
	(a, b, n) = map(int, input().split())
	s = 0
	lst = []
	while True:
		s = a + b
		lst.append(s)
		a = max(a, b)
		b = s
		if s > n:
			break
	le = len(lst)
	st = st + str(le) + '\n'
print(st)


for _ in range(int(input())):
	(x, y, n) = map(int, input().split())
	a = x
	b = y
	x = min(a, b)
	y = max(a, b)
	c = 0
	flag = 0
	while True:
		if flag == 0:
			x = x + y
			c += 1
			flag = 1
			if x > n:
				break
		else:
			y += x
			c += 1
			flag = 0
			if y > n:
				break
	print(c)


t = int(input())
mi = 0
ma = 0
steps = 0
for i in range(t):
	x = input().split(' ')
	a = int(x[0])
	b = int(x[1])
	n = int(x[2])
	mi = min(a, b)
	ma = max(a, b)
	while True:
		mi += ma
		steps += 1
		if mi > n:
			break
		if mi + ma > n:
			steps += 1
			break
		ma += mi
		steps += 1
		if ma > n:
			break
		if ma + mi > n:
			steps += 1
			break
	print(steps)
	steps = 0


import sys
input = sys.stdin.readline
import heapq
import copy
import math
import decimal

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def insr2():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	ans = 0
	for test in range(tests):
		[a, b, n] = inlt()
		a = [a, b]
		a.sort()
		i = 0
		while max(a) <= n:
			a[i % 2] = sum(a)
			i = i + 1
		print(i)
main()


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	ans = [min(a, b), max(a, b)]
	while ans[-1] <= n:
		ans += [ans[-1] + ans[-2]]
	print(len(ans) - 2)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a < b:
		t = a
		a = b
		b = t
	turn = 0
	while max(a, b) <= n:
		if turn % 2 == 0:
			b += a
		else:
			a += b
		turn += 1
	print(turn)


t = int(input())
for _ in range(t):
	(a, b, num) = map(int, input().split())
	cou = 0
	while a <= num and b <= num:
		if a >= b:
			b += a
		else:
			a += b
		cou += 1
	print(cou)


import math
for _ in range(int(input())):
	(a, b, v) = map(int, input().split())
	ans = 0
	while a <= v and b <= v:
		(a, b) = (min(a, b) + max(a, b), max(a, b))
		ans += 1
	print(ans)


t = int(input())
for i in range(0, t):
	d = 0
	j = 0
	(a, b, c) = map(int, input().split())
	if b > a:
		temp = a
		a = b
		b = temp
	while 1:
		if j % 2 == 0:
			b = b + a
			d = d + 1
		else:
			a = a + b
			d = d + 1
		j = j + 1
		if b > c or a > c:
			print(d)
			d = 0
			break


def solve():
	(a, b, n) = tuple(map(int, input().split()))
	ops = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		ops += 1
	return ops

def main():
	t = int(input())
	for _ in range(t):
		print(solve())
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	ret = 0
	if a > b:
		(a, b) = (b, a)
	while True:
		a += b
		ret += 1
		if a > n:
			break
		b += a
		ret += 1
		if b > n:
			break
	print(ret)


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	flag = True
	count = 0
	while a <= n and b <= n:
		if b <= a:
			b += a
			flag = False
		else:
			flag = True
			a += b
		count += 1
	print(count)


def minVal(n, m, k):
	arr = sorted([n, m])
	count = 0
	while arr[1] <= k:
		temp = arr[1]
		arr[1] = sum(arr)
		arr[0] = temp
		count += 1
	return count
for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	print(minVal(n, m, k))


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	k = 0
	if a > b:
		(a, b) = (b, a)
	while a <= n and b <= n:
		a = a + b
		(a, b) = (b, a)
		k = k + 1
	print(k)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a < b:
		s = a
		g = b
	else:
		s = b
		g = a
	ad = 0
	c = 0
	while ad <= n:
		ad = s + g
		s = ad
		x = s
		y = g
		s = min(x, y)
		g = max(x, y)
		c += 1
	print(c)


import sys
t = int(sys.stdin.readline())
for i in range(t):
	(a, b, n) = map(int, sys.stdin.readline().strip().split())
	if a > b:
		(a, b) = (b, a)
	count = 0
	for i in range(n):
		a += b
		count += 1
		if a > n or b > n:
			print(count)
			break
		b += a
		count += 1
		if a > n or b > n:
			print(count)
			break


from sys import stdin
input = lambda : stdin.readline().strip()
char = [chr(i) for i in range(97, 123)]
CHAR = [chr(i) for i in range(65, 91)]
mp = lambda : list(map(int, input().split()))
INT = lambda : int(input())
rn = lambda : range(INT())
from math import ceil, sqrt, factorial, gcd
for _ in rn():
	(a, b, n) = mp()
	ans = 0
	while a <= n and b <= n:
		if a > b:
			b += a
			ans += 1
		else:
			a += b
			ans += 1
	print(ans)


t = int(input())
for tt in range(0, t, 1):
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	s = 0
	h = 0
	while h == 0:
		if a <= b:
			a = a + b
			s = s + 1
		elif a > b:
			b = b + a
			s = s + 1
		if a > n or b > n:
			break
	print(s)


import sys
import math
import collections
from sys import stdin, stdout, setrecursionlimit
import bisect as bs
setrecursionlimit(2 ** 20)
M = 10 ** 9 + 7

def solve():
	(a1, b1, n) = list(map(int, stdin.readline().split()))
	ans = 0
	a = max(a1, b1)
	b = min(a1, b1)
	while a <= n and b <= n:
		t = a + b
		b = a
		a = t
		ans += 1
	print(ans)
t = 1
t = int(stdin.readline())
for _ in range(t):
	solve()


for x in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	k = max(a, b)
	l = 0
	while k <= n:
		c = max(a, b)
		d = min(a, b)
		d += c
		k = d
		a = c
		b = d
		l += 1
	print(l)


for ttt in range(int(input())):
	(a, b, n) = map(int, input().split())
	x = 0
	if a > b:
		(a, b) = (b, a)
	while b <= n:
		(a, b) = (b, a + b)
		x += 1
	print(x)


def solve():
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans = 0
	while b <= n:
		a += b
		(a, b) = (min(a, b), max(a, b))
		ans += 1
	print(ans)
for i in range(int(input())):
	solve()


T = int(input())
ans = []
for i in range(T):
	(a, b, n) = map(int, input().split())
	cum = 0
	tot = 0
	if a > b:
		useA = False
	else:
		useA = True
	for j in range(n + 1):
		if a > n or b > n:
			ans.append(tot)
			break
		else:
			if useA:
				useA = False
				a += b
			else:
				useA = True
				b += a
			tot += 1
if len(ans) == 0:
	print(0)
else:
	for i in range(len(ans)):
		print(ans[i])


memory = {0: 0, 1: 1}

def f(n):
	if n in memory:
		return memory[n]
	else:
		memory[n] = f(n - 1) + f(n - 2)
		return memory[n]
t = int(input())
for i in range(t):
	(a, b, n) = [int(x) for x in input().split()]
	count = 0
	(a, b) = (min(a, b), max(a, b))
	while f(count) * a + f(count + 1) * b <= n:
		count += 1
	print(count)


for test_case in range(int(input())):
	(a, b, n) = map(int, input().split())
	operation = 0
	big = max(a, b)
	small = min(a, b)
	while big <= n:
		result = big + small
		small = big
		big = result
		operation += 1
	print(operation)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	(a, b, n) = mints()
	if a > b:
		(a, b) = (b, a)
	i = 0
	while b <= n:
		i += 1
		(a, b) = (b, a + b)
	print(i)
for i in range(mint()):
	solve()


from sys import stdin
for case in range(int(stdin.readline())):
	(a, b, n) = [int(x) for x in stdin.readline().split()]
	num = 0
	while a <= n and b <= n:
		num += 1
		if a <= b:
			a += b
		else:
			b += a
	print(num)


for test in range(int(input())):
	(a, b, c) = map(int, input().split())
	count = 0
	while True:
		if a > c or b > c:
			break
		if a > b:
			b += a
			count += 1
		elif a <= b:
			a += b
			count += 1
	print(count)


t = int(input())
for i1 in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	d = 0
	while c <= n:
		if a <= b:
			a += b
			c = a
			d += 1
		else:
			b += a
			c = b
			d += 1
	print(d)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	moves = 0
	ac = a
	bc = b
	a = min(a, b)
	b = max(ac, bc)
	while True:
		if a > n or b > n:
			break
		minab = min(a, b)
		maxab = max(a, b)
		minab = minab + maxab
		a = maxab
		b = minab
		moves = moves + 1
	print(moves)


t = int(input())

def invr():
	return map(int, input().split())
k = 0
while k != t:
	(a, b, n) = invr()
	c = a + b
	s = 1
	while c <= n:
		if a > b:
			b = a
			a = c
			c = a + b
		else:
			a = b
			b = c
			c = a + b
		s = s + 1
	k = k + 1
	print(s)


rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : [int(x) for x in rr().split()]
from sys import stdin, stdout

def sol():
	(a, b, n) = rrm()
	x = 0
	q = a < b
	while a <= n and b <= n:
		if q:
			a += b
			q = False
		else:
			b += a
			q = True
		x += 1
	print(x)
	return
T = rri()
for t in range(1, T + 1):
	ans = sol()


def answer(a, b, n):
	if b > a:
		(a, b) = (b, a)
	count = 0
	while max(a, b) <= n:
		if count % 2 == 0:
			b += a
			count += 1
		else:
			a += b
			count += 1
	return count
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	print(answer(a, b, n))


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	ops = 0
	while a <= n and b <= n:
		temp = a + b
		a = max(a, b)
		b = temp
		ops += 1
	print(ops)


f = [0] * 80

def fib():
	f[0] = 1
	f[1] = 1
	for i in range(2, 80):
		f[i] = f[i - 1] + f[i - 2]
	return f
fib()
t = int(input())
while t > 0:
	t = t - 1
	(a, b, n) = map(int, input().split())
	c = max(a, b)
	d = min(a, b)
	for i in range(1, 80):
		if f[i] * c + f[i - 1] * d > n:
			print(i)
			break
		else:
			i = i + 1


import math
for i in range(int(input())):
	(a, b, n) = (int(i) for i in input().split())
	ops = 0
	(a, b) = (min(a, b), max(a, b))
	while max(a, b) <= n:
		ops += 1
		a += b
		(a, b) = (min(a, b), max(a, b))
	print(ops)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	(a, b, n) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	ans = 0
	while a <= n:
		b += a
		(a, b) = (max(a, b), min(a, b))
		ans += 1
	print(ans)


from math import ceil
for _ in range(int(input())):
	turn = 0
	(a, b, n) = map(int, input().split())
	while 1:
		if a < b:
			a = a + b
		else:
			b = a + b
		turn += 1
		if n < max(a, b):
			break
	print(turn)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().strip().split())
	count = 0
	if n >= a or n >= b:
		for i in range(10 ** 9):
			if a < b:
				a = a + b
				count = count + 1
				if a > n or b > n:
					print(count)
					break
			else:
				b = b + a
				count = count + 1
				if b > n or a > n:
					print(count)
					break
	else:
		print(count)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	if a + b > n:
		print(1)
	elif a + b + min(a, b) > n:
		print(2)
	elif a + b + max(a, b) > n:
		print(2)
	else:
		ans1 = 0
		ans2 = 0
		first = a + b
		second = a + b + min(a, b)
		cnt = 2
		while True:
			cnt += 1
			if second + first > n:
				break
			temp = second
			second = first + second
			first = temp
		ans1 = cnt
		cnt = 2
		first = a + b
		second = a + b + max(a, b)
		while True:
			cnt += 1
			if second + first > n:
				break
			temp = second
			second = first + second
			first = temp
		ans2 = cnt
		print(min(ans1, ans2))


from fractions import Fraction
import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def createMatrix(rowCount, colCount, dataList):
	mat = []
	for i in range(rowCount):
		rowList = []
		for j in range(colCount):
			if dataList[j] not in mat:
				rowList.append(dataList[j])
		mat.append(rowList)
	return mat
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	d = []
	c = b
	e = []
	g = a
	h = b
	for i in range(n):
		b = a
		a += c
		c = b
		d.append(a)
		if a > n:
			break
	for i in range(n):
		a = h
		h += g
		g = a
		e.append(h)
		if h > n:
			break
	print(min(len(e), len(d)))


for s in [*open(0)][1:]:
	(a, b, n) = map(int, s.split())
	i = 0
	while b <= n:
		(a, b) = (max(a, b), a + b)
		i += 1
	print(i)


def countMinMoves(a, b, n):
	(num1, num2) = (min(a, b), max(a, b))
	(num, cnt) = (0, 0)
	while num <= n:
		num = num1 + num2
		(num1, num2) = (num2, num)
		cnt += 1
	return cnt
t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	print(countMinMoves(a, b, n))
	t -= 1


for nt in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	fib = [a, b]
	while fib[-1] <= n:
		fib.append(fib[-1] + fib[-2])
	print(len(fib) - 2)


for _ in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	t1 = max(a, b)
	t2 = a + b
	if n < t1:
		print(0)
	elif n < t2:
		print(1)
	else:
		i = 1
		while 1:
			i += 1
			if t1 + t2 > n:
				print(i)
				break
			else:
				temp = t1 + t2
				t1 = t2
				t2 = temp


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	sum = 0
	count = 0
	while sum <= n:
		sum = a + b
		b = max(a, b)
		a = sum
		count += 1
	print(count)


def solve():
	for _ in range(int(input())):
		(a, b, n) = map(int, input().strip().split())
		c = 0
		while a <= n and b <= n:
			ma = max(a, b)
			mi = min(a, b)
			a = ma + mi
			b = ma
			c += 1
		print(c)
solve()


def main():
	for t in range(int(input())):
		(a, b, n) = [int(j) for j in input().split()]
		(a, b) = (min(a, b), max(a, b))
		for i in range(n):
			if i % 2 == 0:
				a += b
				if a > n:
					break
			else:
				b += a
				if b > n:
					break
		print(i + 1)
main()


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	(p, q) = (max(a, b), 0)
	count = 0
	(w, e) = (0, 0)
	while p <= n:
		if a < b:
			a += b
		else:
			b += a
		p = max(a, b)
		count += 1
	print(count)


t = int(input())
while t > 0:
	nd = input().split()
	a = int(nd[0])
	b = int(nd[1])
	n = int(nd[2])
	c = 0
	while b <= n:
		m = max(a, b)
		b = min(a, b)
		b += m
		a = m
		c += 1
	print(c)
	t -= 1


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		(a, b, n) = MI()
		cnt = 0
		while a <= n and b <= n:
			if a < b:
				a += b
			else:
				b += a
			cnt += 1
		print(cnt)
main()


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	count = 0
	maximum = max(a, b)
	minimum = min(a, b)
	while maximum <= n and minimum <= n:
		minimum += maximum
		count += 1
		if minimum > n or maximum > n:
			break
		maximum += minimum
		count += 1
	print(count)


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
p = print
MAX = float('inf')
MIN = float('-inf')

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = ain()
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def main():
	for _ in range(iin()):
		(a, b, n) = ain()
		if a > b:
			(a, b) = (b, a)
		count = 0
		while a <= n or b <= n:
			if count % 2 == 0:
				a += b
			else:
				b += a
			count += 1
		print(count - 1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def solution(a, b, n):
	cnt = 0
	(a, b) = (min(a, b), max(a, b))
	while b <= n:
		(a, b) = (b, a + b)
		cnt += 1
	return cnt
t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split(' ')))
	print(solution(a, b, n))


def C_plus():
	num_arr = input().split()
	num_arr = list(map(int, num_arr))
	counter = 0
	a = max(num_arr[0], num_arr[1])
	b = min(num_arr[0], num_arr[1])
	while a <= num_arr[2] and b <= num_arr[2]:
		if counter % 2 == 0:
			b += a
		else:
			a += b
		counter += 1
	print(counter)
num_iter = int(input())
for _ in range(num_iter):
	C_plus()


from collections import Counter, defaultdict
BS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def to_base(s, b):
	res = ''
	while s:
		res += BS[s % b]
		s //= b
	return res[::-1] or '0'
alpha = 'abcdefghijklmnopqrstuvwxyz'
from math import floor, ceil, pi
import re
pattern = '0+'
t = int(input())
for i in range(t):
	(a, b, n) = list(map(int, input().split()))
	c = 0
	while a <= n and b <= n:
		c += 1
		if a < b:
			a += b
		else:
			b += a
	print(c)


import math
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	i = 0
	if a > b:
		(a, b) = (b, a)
	while a <= n:
		if a + b > n:
			i += 1
			break
		if i % 2 == 0:
			a += b
		else:
			b += a
		i += 1
	print(i)


k = input()
k = int(k)
for i in range(k):
	val = [int(j) for j in input().split()]
	a = val[0]
	b = val[1]
	n = val[2]
	cnt = 0
	while True:
		if a > n or b > n:
			break
		if a > b:
			b = b + a
		else:
			a = a + b
		cnt = cnt + 1
	print(cnt)


tests = int(input())
lista = []
for i in range(tests):
	num = 0
	(a1, b1, n) = [int(q) for q in input().split()]
	if a1 <= b1:
		a = a1
		b = b1
	else:
		a = b1
		b = a1
	while True:
		if min(a, b) == a:
			a += b
			num += 1
		else:
			b += a
			num += 1
		if a > n or b > n:
			break
	lista.append(num)
for i in lista:
	print(i)


t = int(input())
while t != 0:
	(a, b, n) = [int(x) for x in input().split()]
	count = 0
	while a <= n and b <= n:
		if a > b:
			b += a
			count += 1
		else:
			a += b
			count += 1
	print(count)
	t -= 1


def steps(a, b, n):
	final = [a, b]
	final.sort()
	a = final[0]
	b = final[1]
	count = 0
	while b <= n:
		(a, b) = (b, a + b)
		count = count + 1
	return count
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	print(steps(a, b, n))


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	while a <= n and b <= n:
		m = min(a, b)
		if m == a:
			c += 1
			a += b
		else:
			c += 1
			b += a
	print(c)


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
while t:
	(n, m, l) = map(int, input().split())
	cou = 0
	if n > m:
		(n, m) = (m, n)
	nn = n
	mm = m
	lol = 0
	cou1 = 0
	while n <= l and m <= l:
		if lol % 2 == 0:
			m += n
		else:
			n += m
		cou += 1
		lol += 1
	lol = 0
	while nn <= l and mm <= l:
		if lol % 2 == 0:
			nn += mm
		else:
			mm += nn
		cou1 += 1
		lol += 1
	print(min(cou, cou1))
	t -= 1


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	a0 = min(a, b)
	b0 = max(a, b)
	count0 = 0
	while a0 <= n and b0 <= n:
		a0 += b0
		count0 += 1
		if a0 > n:
			break
		else:
			b0 += a0
			count0 += 1
	print(count0)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	op = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		op += 1
	print(op)


t = int(input())
while t > 0:
	t -= 1
	x = input().split()
	a = int(x[0])
	b = int(x[1])
	n = int(x[2])
	count = 0
	while a <= n or b <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
		if a > n or b > n:
			break
	print(count)


n = int(input())
for w in range(n):
	(a, b, c) = map(int, input().split())
	f = 0
	while a <= c and b <= c:
		if a < b:
			a = a + b
		else:
			b = b + a
		f += 1
	print(f)


import math
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	mn = min(a, b)
	mx = max(a, b)
	if mx > n:
		print(0)
	else:
		count = 1
		while mn + mx <= n:
			temp = mx
			mx = mn + mx
			mn = temp
			count += 1
		print(count)


from collections import Counter
nrew = int(input())
for wew in range(nrew):
	(a, b, n) = list(map(int, input().split(' ')))
	if a > n or b > n:
		print(0)
		continue
	m = max(a, b)
	a += b
	b = m
	ans = 1
	while a <= n and b <= n:
		b += a
		ans += 1
		temp = a
		a = b
		b = temp
	print(ans)


t = int(input())
for i in range(0, t):
	(x, y, z) = [int(x) for x in input().split()]
	l = []
	l.append(x)
	l.append(y)
	l = sorted(l)
	ans = 0
	j = 0
	while ans <= z:
		ans = l[-1] + l[-2]
		l.append(ans)
		j += 1
	print(j)


t = int(input())
for tc in range(t):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while a <= n and b <= n:
		if a < b or a == b:
			a += b
		else:
			b += a
		cnt += 1
	print(cnt)


import sys
input = sys.stdin.readline
t = int(input())
for t1 in range(t):
	(a, b, t) = list(map(int, input().split(' ')))
	count = 0
	while a <= t and b <= t:
		if a > b:
			b += a
			count += 1
		else:
			a += b
			count += 1
	print(count)


for i in range(int(input())):
	(aa, bb, n) = map(int, input().split())
	ans = 0
	i = 0
	a = min(aa, bb)
	b = max(aa, bb)
	while a <= n and b <= n:
		if i % 2 == 0:
			a += b
			ans += 1
			i += 1
		else:
			b += a
			ans += 1
			i += 1
	print(ans)


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	minn = min(a, b)
	maxx = max(a, b)
	cnt = 0
	while minn <= n and maxx <= n:
		if cnt % 2 == 0:
			minn += maxx
		else:
			maxx += minn
		cnt += 1
	print(cnt)


import math
for _ in range(int(input())):
	(A, B, C) = map(int, input().split())
	(A, B) = (min(A, B), max(A, B))
	sol = 0
	while A <= C and B <= C:
		sol += 1
		A += B
		(A, B) = (min(A, B), max(A, B))
	print(sol)


test_cases = int(input())
for z in range(test_cases):
	ans = 0
	(a, b, n) = list(map(int, input().split()))
	fib = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049, 12586269025]
	for i in range(len(fib) - 1):
		if fib[i] * min(a, b) + fib[i + 1] * max(a, b) > n:
			ans = i
			break
	print(ans)


for t in range(int(input())):
	(a, b, n) = map(int, input().split())
	maxu = max(a, b)
	minu = min(a, b)
	s = 0
	while maxu <= n and minu <= n:
		s += 1
		minu += maxu
		c = minu
		minu = maxu
		maxu = c
	print(s)


from math import inf as inf
from math import *
from collections import *
import sys
from itertools import permutations
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	r = 0
	(a, b) = (min(a, b), max(a, b))
	while a <= n and b <= n:
		f = a + b
		a = max(a, b)
		b = f
		r += 1
	print(r)


try:
	for _ in range(int(input())):
		(a, b, n) = map(int, input().split())
		i = 0
		c = 0
		b1 = max(a, b)
		a1 = min(a, b)
		while not (a1 > n or b1 > n):
			if i % 2 == 0:
				a1 += b1
			else:
				b1 += a1
			c += 1
			i += 1
		print(c)
except EOFError:
	pass


def solve():
	(a, b, n) = list(map(int, input().split()))
	ans = 0
	while a <= n and b <= n:
		if a < b:
			a += b
			ans += 1
			(a, b) = (b, a)
		else:
			b += a
			ans += 1
	print(ans)
	return

def main():
	t = int(input())
	while t:
		solve()
		t -= 1
main()


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	count = 0
	k = min(a, b)
	m = max(a, b)
	while m <= n or k <= n:
		k += m
		count += 1
		if k > n:
			print(count)
			break
		m += k
		count += 1
		if m > n:
			print(count)
			break


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	o = max(a, b)
	p = min(a, b)
	cnt = 0
	while o <= n:
		x = o
		o = o + p
		p = x
		cnt = cnt + 1
	print(cnt)


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	(a, b, n) = MI()
	(a, b) = (min(a, b), max(a, b))
	count = 0
	while b <= n and a <= n:
		a += b
		count += 1
		if a > n:
			break
		b += a
		count += 1
	print(count)


def func(a, b, n):
	f = min(a, b)
	s = max(a, b)
	count = 0
	while f <= n and s <= n:
		f += s
		(f, s) = (s, f)
		count += 1
	return count
t = int(input())
for i in range(t):
	A = list(map(int, input().split()))
	print(func(A[0], A[1], A[2]))


from math import ceil
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 0
	while True:
		x = min(a, b)
		y = max(a, b)
		if y > n:
			break
		a = x
		b = y
		a = b + a
		c += 1
	print(c)


for T in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a > b:
		arr = [b, a]
	else:
		arr = [a, b]
	count = 0
	while arr[-1] <= n:
		b = arr[-1]
		arr[-1] = arr[-1] + arr[-2]
		arr[-2] = b
		count += 1
	print(count)


test = int(input())
for i in range(test):
	(a, b, n) = map(int, input().split())
	count = 0
	maxi = 0
	while maxi < n:
		mini = max(a, b)
		maxi = a + b
		a = mini
		b = maxi
		count += 1
	if maxi <= n:
		count += 1
	print(count)


def cPlusAss(aa):
	(a, b, n) = (aa[0], aa[1], aa[2])
	c = 0
	while a <= n or b <= n:
		if a > b:
			b += a
		else:
			a += b
		c += 1
	return c - 1
tc = int(input())
for i in range(tc):
	n = list(map(int, input().split()))
	print(cPlusAss(n))


def moves_to_make_greater(a, b, n):
	moves = 0
	while a + b <= n:
		if a < b:
			a += b
		else:
			b += a
		moves += 1
	return moves + 1
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	print(moves_to_make_greater(a, b, n))


def soma(maior, menor, t, op=0):
	if maior > t or menor > t:
		print(op)
		return
	menor += maior
	op += 1
	soma(menor, maior, t, op)
qc = int(input())
for c in range(qc):
	(a, b, n) = map(int, input().split())
	soma(max(a, b), min(a, b), n)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(A, B, N) = [int(x) for x in input().split()]
		ans = 0
		while A <= N and B <= N:
			ans += 1
			if A > B:
				B += A
			else:
				A += B
		print(ans)
main()


import math
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	mx = max(a, b)
	mi = min(a, b)
	if mx > n:
		print(0)
	else:
		ans = 0
		while mx <= n:
			nmi = mi
			mi = mx
			mx = nmi + mx
			ans = ans + 1
		print(ans)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	r = 0
	c = b
	while c <= n:
		c = a + b
		a = b
		b = c
		r += 1
	print(r)


for cases in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	count = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	print(count)


n = int(input())
for i in range(n):
	(a, b, t) = map(int, input().split())
	count = 0
	j = 0
	if a < b:
		l = a
		a = b
		b = l
	if a == b == 0:
		print(0)
	elif a > t or b > t:
		print(0)
	else:
		while 1:
			if j == 0:
				b = b + a
				j = 1
				count = count + 1
			elif j == 1:
				a = a + b
				j = 0
				count = count + 1
			else:
				pass
			if a > t or b > t:
				break
		print(count)


n = int(input())

def calc(a, b, k):
	c = 1
	while a + b <= k:
		if a > b:
			b += a
		else:
			a += b
		c += 1
	print(c)
for i in range(n):
	(a, b, k) = map(int, input().split())
	calc(a, b, k)


for z in range(int(input())):
	(a, b, n) = [int(i) for i in input().split()]
	cnt = 0
	while a <= n or b <= n:
		if a >= b:
			b += a
			cnt += 1
		else:
			a += b
			cnt += 1
	print(cnt - 1)


def solve(step, a, b, n):
	if a > n or b > n:
		print(step)
		return
	if a > b:
		b += a
		step += 1
		solve(step, a, b, n)
	else:
		a += b
		step += 1
		solve(step, a, b, n)
t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	solve(0, a, b, n)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	A = [a]
	B = [b]
	k = 0
	while True:
		if A[-1] > n or B[-1] > n:
			break
		x = A[-1] + B[-1]
		if k % 2 == 0:
			A.append(x)
		else:
			B.append(x)
		k += 1
	q = 0
	al = [a]
	bl = [b]
	while True:
		if al[-1] > n or bl[-1] > n:
			break
		x = al[-1] + bl[-1]
		if q % 2 == 0:
			bl.append(x)
		else:
			al.append(x)
		q += 1
	print(min(k, q))


from functools import reduce
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	for i in range(inin()):
		(a, b, n) = map(int, input().split())
		if b > a:
			(a, b) = (b, a)
		count = 0
		flag = 0
		while a <= n or b <= n:
			if flag == 0:
				b += a
			else:
				a += b
			count += 1
			flag = 1 - flag
			if a > n or b > n:
				break
		print(count)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = eval(input())
for _ in range(t):
	abn = input().split(' ')
	a = int(abn[0])
	b = int(abn[1])
	n = int(abn[2])
	ans = 0
	while a <= n or b <= n:
		if a > b:
			b += a
		else:
			a += b
		ans += 1
	print(ans - 1)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
sys.setrecursionlimit(int(pow(10, 6)))
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(l()[0]):
	(a, b, n) = l()
	k = 0
	while max([a, b]) <= n:
		if b < a:
			(a, b) = (b, a)
		a += b
		k += 1
	print(k)


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def main():

	def solve():
		(a, b, n) = map(int, inputi().split())
		if a > b:
			(b, a) = (a, b)
		count = 0
		while b <= n:
			(a, b) = (b, a + b)
			count += 1
		print(count)
	t = int(inputi())
	for _ in range(t):
		solve()
main()


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	ans = 0
	alt = 0
	c = a
	d = b
	while a < n + 1 and b < n + 1:
		if ans % 2 == 0:
			a += b
		else:
			b += a
		ans += 1
	a = c
	b = d
	while a < n + 1 and b < n + 1:
		if alt % 2 == 0:
			b += a
		else:
			a += b
		alt += 1
	print(min(ans, alt))


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	if b < a:
		(a, b) = (b, a)
	i = 0
	while b <= n:
		a += b
		(a, b) = (min(a, b), max(a, b))
		i += 1
	print(i)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	lis = [a, b]
	bigger = max(lis)
	ops = 0
	while bigger <= n:
		lis[1 - lis.index(bigger)] += bigger
		ops += 1
		bigger = max(lis)
	print(ops)


T = int(input())
for i in range(T):
	x = list(map(int, input().split()))
	(a, b, n) = (x[0], x[1], x[2])
	counter = 0
	while a <= n or b <= n:
		if a > b:
			b += a
			counter += 1
		else:
			a += b
			counter += 1
	print(counter - 1)


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi
import heapq

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		(a, b, n) = In()
		if a > b:
			(a, b) = (b, a)
		ans = 0
		while n >= max(a, b):
			ans += 1
			if a > b:
				b += a
			else:
				a += b
		print(ans)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	cnt = 0
	while True:
		if a > n:
			break
		cnt += 1
		b += a
		if b > n:
			break
		cnt += 1
		a += b
	print(cnt)


test_case = int(input())
for i in range(test_case):
	count = 0
	values = list(map(int, input().split(' ')))
	while count <= values[2]:
		if values[0] > values[2] or values[1] > values[2]:
			break
		else:
			values[values.index(min(values[0], values[1]))] += max(values[0], values[1])
			count += 1
	print(count)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	num = 0
	while 1:
		if a > n or b > n:
			break
		sum = a + b
		if a > b:
			b = sum
		else:
			a = sum
		num += 1
	print(num)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split(' '))
	(c1, c2) = (0, 0)
	(a1, b1) = (a, b)
	while a <= n and b <= n:
		if c1 % 2 == 0:
			a += b
		else:
			b += a
		c1 += 1
	while a1 <= n and b1 <= n:
		if c2 % 2 != 0:
			a1 += b1
		else:
			b1 += a1
		c2 += 1
	print(min(c1, c2))


T = int(input())
for t in range(1, T + 1):
	string = input().split()
	a = int(string[0])
	b = int(string[1])
	n = int(string[2])
	k = 0
	x = 0
	while a <= n and b <= n:
		if a == min(a, b):
			a += b
		else:
			b += a
		k += 1
	print(k)


t = int(input())
for test in range(t):
	(a, b, n) = [int(x) for x in input().split()]
	op = 0
	(a, b) = (min(a, b), max(a, b))
	mode = 0
	while a <= n and b <= n:
		op += 1
		if mode == 0:
			a += b
			mode = 1
		else:
			b += a
			mode = 0
	print(op)


import sys
T = int(sys.stdin.readline())
ans_arr = []
for t in range(T):
	[a, b, n] = [int(i) for i in sys.stdin.readline().split()]
	if a > n or b > n:
		ans_arr.append(str(0))
	else:
		n1 = min(a, b)
		n2 = max(a, b)
		ctr = 0
		while True:
			ctr += 1
			if n1 + n2 > n:
				break
			tmp = n1
			n1 = n2
			n2 = tmp + n2
		ans_arr.append(str(ctr))
print('\n'.join(ans_arr))


t = int(input())
for i in range(t):
	count = 0
	x = input()
	(a, b, n) = [int(i) for i in x.split(' ')]
	if a < b:
		small = a
		big = b
	else:
		small = b
		big = a
	while small <= n and big <= n:
		small += big
		count += 1
		if small > n:
			break
		big += small
		count += 1
	print(count)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	(a1, b1) = (b, a)
	ans = 0
	while a <= c and b <= c:
		a += b
		ans += 1
		if a > c:
			break
		b += a
		ans += 1
		if b > c:
			break
	ans1 = 0
	(a, b) = (a1, b1)
	while a <= c and b <= c:
		a += b
		ans1 += 1
		if a > c:
			break
		b += a
		ans1 += 1
		if b > c:
			break
	fans = min(ans, ans1)
	print(fans)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	cnt = 0
	x = 1
	while a <= n and b <= n:
		cnt += 1
		if x == 1:
			b += a
		else:
			a += b
		x *= -1
	print(cnt)


for _ in range(int(input())):
	i = 0
	(a, b, c) = map(int, input().strip().split())
	while 1:
		if b > a:
			a += b
			i += 1
		else:
			b += a
			i += 1
		if a > c or b > c:
			break
	print(i)


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	(a, b, n) = get_tuple()
	c = 0
	while a <= n and b <= n:
		if a < b:
			(a, b) = (b, a)
		b += a
		c += 1
	return c

def main():
	print(solve())
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

def main():
	for _ in range(N()):
		res = 0
		(a, b, n) = RL()
		while a <= n and b <= n:
			if a < b:
				a += b
			else:
				b += a
			res += 1
		print(res)
main()


from sys import *
input = stdin.readline
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	c = 0
	while x <= n and y <= n:
		x += y
		a = min(x, y)
		b = max(x, y)
		x = a
		y = b
		c += 1
	print(c)


T = int(input())
memo = {}

def fib(n):
	if n == 0:
		return 0
	if n == 1:
		return 1
	if n in memo:
		return memo[n]
	else:
		result = fib(n - 1) + fib(n - 2)
		memo[n] = result
	return memo[n]

def main(arr):
	(a, b, n) = arr
	ans = 0
	i = 0
	while ans <= n:
		i += 1
		ans = max([a, b]) * fib(i) + min([a, b]) * fib(i - 1)
	return i - 1
allarray = []
for i in range(T):
	allarray.append(list(map(int, input().split())))
for arr in allarray:
	print(main(arr))


t = int(input())
for _ in range(t):
	c = list(map(int, input().split()))
	a = c[0:2]
	n = c[2]
	a.sort(reverse=True)
	k = 0
	while 1:
		a[1] += a[0]
		k += 1
		if a[0] > n or a[1] > n:
			break
		a[0] += a[1]
		k += 1
		if a[0] > n or a[1] > n:
			break
	print(k)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	sum1 = 0
	count = 0
	while sum1 <= n:
		if a >= b:
			b = b + a
			sum1 = b
		else:
			a = a + b
			sum1 = a
		count = count + 1
	print(count)


INT_MAX = 10 ** 11 + 7
MOD = 10 ** 9 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
import math

def calc(a, b, n):
	if b > n:
		return 0
	if a > b:
		(a, b) = (b, a)
	dp = [0] * 100
	dp[0] = a
	dp[1] = b
	for i in range(2, 100):
		dp[i] = dp[i - 1] + dp[i - 2]
	i = 0
	while i < 100:
		if dp[i] > n:
			break
		i += 1
	return i - 1
for i in range(int(input())):
	(a, b, n) = INPUT()
	print(calc(a, b, n))


t = int(input())
while t != 0:
	(a, b, n) = map(int, input().split())
	to = 0
	(a, b) = (min(a, b), max(a, b))
	while b <= n:
		temp = b
		b += a
		a = temp
		to += 1
	print(to)
	t = t - 1


t = int(input())
for i in range(t):
	inputs = input().split()
	a = int(inputs[0])
	b = int(inputs[1])
	n = int(inputs[2])
	if a == 0 and b == 0:
		print(0)
	else:
		if a >= b:
			n2 = a
			n1 = b
		else:
			n2 = b
			n1 = a
		count = 0
		while n1 <= n and n2 <= n:
			nt = n1 + n2
			n1 = n2
			n2 = nt
			count += 1
		print(count)


t = int(input())
for i in range(t):
	(a, b, n) = [int(n) for n in input().split()]
	q = max(a, b)
	w = min(a, b)
	arr = []
	arr.append(w)
	arr.append(q)
	count = 0
	while arr[-1] <= n:
		arr.append(arr[-2] + arr[-1])
		count = count + 1
	print(count)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	op = 0
	_a = min(a, b)
	_b = max(a, b)
	a = _a
	b = _b
	while a <= n:
		a += b
		_a = min(a, b)
		_b = max(a, b)
		a = _a
		b = _b
		op += 1
	print(op - 1)


for s in range(int(input())):
	(a, b, n) = map(int, input().split(' '))
	p = 0
	while n >= b:
		(a, b) = (max(a, b), a + b)
		p += 1
	print(p)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	l = [min(a, b), max(a, b)]
	k = 1
	count = 0
	while l[k] <= n:
		l.append(l[k] + l[k - 1])
		count += 1
		k += 1
	print(count)


import math
import os
import random
import re
import sys
from array import array
t = int(input().strip())
c = []
r = []
for i in range(t):
	ar = list(map(int, input().split()))
	c.append(ar)
for i in range(t):
	x = c[i]
	a = int(x[0])
	b = int(x[1])
	n = int(x[2])
	k = 0
	ex = 0
	while ex != 1:
		if a <= b:
			a = a + b
			k = k + 1
		else:
			b = b + a
			k = k + 1
		if a > n:
			r.append(k)
			ex = 1
		elif b > n:
			r.append(k)
			ex = 1
for i in range(t):
	print(r[i])


import sys
try:
	sys.stdin = open('inputs.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
finally:
	input = sys.stdin.readline
	print = sys.stdout.write
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	count = 0
	(b, a) = (max(a, b), min(a, b))
	while a <= n:
		a = a + b
		(a, b) = (b, a)
		count += 1
	print(str(count - 1))
	print('\n')


for i in range(int(input())):
	a = list(map(int, input().split()))
	counter = 1
	while a[0] + a[1] <= a[2]:
		a[a.index(min(a[0], a[1]))] += max(a[0], a[1])
		counter += 1
	print(counter)


import math, sys, bisect
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])
for _ in range(int(input())):
	(a, b, n) = ilele()
	x = max(a, b)
	y = min(a, b)
	count = 0
	while x <= n:
		y += x
		a = x
		b = y
		count += 1
		x = max(a, b)
		y = min(a, b)
	print(count)


def solve(a, b, n):
	(a, b) = (min(a, b), max(a, b))
	i = 0
	while True:
		if a > n or b > n:
			break
		elif a <= n:
			a = a + b
			i += 1
		if b > n or a > n:
			break
		elif b <= n:
			b = a + b
			i += 1
	return i
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	print(solve(a, b, n))


t = int(input())
while t != 0:
	(a, b, n) = map(int, input().split())
	t -= 1
	if a < b:
		lower = a
		higher = b
	else:
		lower = b
		higher = a
	i = higher
	count = 0
	n1 = lower
	n2 = higher
	while i <= n:
		i = n1 + n2
		n1 = n2
		n2 = i
		count += 1
	print(count)


import math
import collections
import statistics
import datetime

def main():
	for i in range(int(input())):
		(a, b, n) = map(int, input().split())
		count = 0
		while a <= n and b <= n:
			if a >= b:
				(a, b) = (a, a + b)
				count += 1
			else:
				(a, b) = (a + b, b)
				count += 1
		print(count)
main()


ans = []
t = int(input())
for i in range(t):
	c = 0
	n = input()
	s = n.split()
	a = int(s[0])
	b = int(s[1])
	n = int(s[2])
	if a < b:
		(a, b) = (b, a)
	while a <= n and b <= n:
		b += a
		c = c + 1
		if b > n:
			break
		a += b
		c += 1
		if a > n:
			break
	ans.append(c)
for j in ans:
	print(j)


import math as mt
import collections as cc
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(a, b, n) = I()
	c = 0
	while 1:
		if b > a:
			(a, b) = (b, a)
		b += a
		c += 1
		if max(a, b) > n:
			break
	print(c)


case = int(input())
for caseNum in range(0, case):
	(a, b, c) = [int(x) for x in input().split()]
	if a > b:
		(a, b) = (b, a)
	answer = 0
	while a <= c and b <= c:
		answer += 1
		a += b
		(a, b) = (b, a)
	print(answer)


def steps(a, b, n):
	i = 0
	j = 0
	while i <= n:
		if a >= b:
			b += a
			i = b
			j += 1
		else:
			a += b
			i = a
			j += 1
	return j
for _ in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	ans = steps(a, b, n)
	print(ans)


for _ in range(int(input())):
	(a, b, k) = map(int, input().split())
	count = 0
	while True:
		if a < b:
			a += b
		else:
			b += a
		count += 1
		if a > k or b > k:
			break
	print(count)


def fun(a, b, c, count):
	if a > c or b > c:
		return count
	elif a > b:
		b = b + a
		return fun(a, b, c, count + 1)
	else:
		a = a + b
		return fun(a, b, c, count + 1)
n1 = int(input())
for x in range(n1):
	s = input()
	l1 = s.split(' ')
	a = int(l1[0])
	b = int(l1[1])
	c = int(l1[2])
	print(fun(a, b, c, 0))


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	operations = 0
	while True:
		operations += 1
		if a + b > c:
			break
		if a > b:
			b += a
		else:
			a += b
	print(operations)


for testcase in range(int(input())):
	(a, b, n) = map(int, input().split())
	(m, M) = (min(a, b), max(a, b))
	c = 0
	while 1:
		m += M
		(m, M) = (M, m)
		c += 1
		if M > n:
			break
	print(c)


t = int(input())
import functools

@functools.lru_cache(None)
def solve(a, b, n):
	if a > n or b > n:
		return 0
	if a + b > n:
		return 1
	if a > b:
		return 1 + solve(a, b + a, n)
	else:
		return 1 + solve(a + b, b, n)
for _ in range(t):
	(a, b, n) = map(int, input().split())
	print(solve(a, b, n))


import sys
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda : sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans = 0
	while b <= n:
		a += b
		(b, a) = (a, b)
		ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().strip().split()))
	cnt = 0
	while a <= n and b <= n:
		(a, b) = (min(a, b), max(a, b))
		a += b
		cnt += 1
	print(cnt)


t = int(input())
for i in range(t):
	count = 0
	x = list(map(int, input().split()))
	stop = x[2]
	v1 = x[0]
	v2 = x[1]
	while v1 <= stop or v2 <= stop:
		if v1 <= v2:
			v1 += v2
		else:
			v2 += v1
		count += 1
	print(count - 1)


import sys
import random
from math import *

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def finput():
	return float(input())

def tinput():
	return input().split()

def linput():
	return list(input())

def rinput():
	return map(int, tinput())

def fiinput():
	return map(float, tinput())

def rlinput():
	return list(map(int, input().split()))

def trinput():
	return tuple(rinput())

def srlinput():
	return sorted(list(map(int, input().split())))

def YESNO(fl):
	if fl:
		print('NO')
	else:
		print('YES')

def main():
	(a, b, n) = rinput()
	g = 0
	(a, b) = sorted([a, b])
	while b <= n:
		a += b
		g += 1
		if a > n:
			break
		b += a
		g += 1
	print(g)
for inytd in range(int(input())):
	main()


t = int(input())
for i in range(t):
	(a, b, n) = list(map(int, input().split()))
	ctr = 0
	while a <= n and b <= n:
		k = min(a, b)
		if k == a:
			a += b
		else:
			b += a
		ctr += 1
	print(ctr)


a = int(input())
for i in range(a):
	b = list(map(int, input().rstrip().split()))
	if b[0] > b[1]:
		c = b[1]
		d = b[0]
	else:
		c = b[0]
		d = b[1]
	j = 0
	while c <= b[2] and d <= b[2]:
		c += d
		j += 1
		if c > b[2]:
			break
		d += c
		j += 1
		if d > b[2]:
			break
	print(j)


k = int(input())
for t in range(k):
	(a, b, n) = [int(i) for i in input().split(' ')]
	count = 0
	while a <= n and b <= n:
		count += 1
		if a < b:
			a += b
		else:
			b += a
	print(count)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	k = a + b
	if a < b:
		a = k
	else:
		b = k
	ans = 1
	while k <= n:
		k += min(a, b)
		if a < b:
			a = k
		else:
			b = k
		ans += 1
	print(ans)


t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	cnt = 0
	flg = True
	while x <= n and y <= n:
		if not flg:
			x = x + y
		else:
			y = x + y
		flg = not flg
		cnt += 1
	print(cnt)


import sys
input = sys.stdin.buffer.readline
a = int(input())
for x in range(a):
	(b, c, d) = map(int, input().split())
	h = 0
	while b <= d and c <= d:
		if b < c:
			b += c
		else:
			c += b
		h += 1
	print(h)


for _ in range(int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	ans = 0
	if a < b:
		(a, b) = (b, a)
	while a <= n and b <= n:
		if ans % 2 == 1:
			a = a + b
		else:
			b = a + b
		ans += 1
	print(ans)


t = int(input())
for x in range(t):
	(a, b, n) = map(int, input().split(' '))
	count = 0
	while a <= n and b <= n:
		(q, w) = (a + 2 * b, b + 2 * a)
		if q > w:
			a += b
		else:
			b += a
		count += 1
	print(count)


import sys
input = sys.stdin.readline

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()

def lower_letters():
	lowercase = [chr(i) for i in range(97, 97 + 26)]
	return lowercase

def upper_letters():
	uppercase = [chr(i) for i in range(65, 65 + 26)]
	return uppercase
for _ in range(int(input())):
	(a, b, n) = int_array()
	large = max(a, b)
	if large == a:
		small = b
	else:
		small = a
	count = 0
	while large <= n:
		count += 1
		x = large
		large += small
		small = x
	print(count)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	while n >= a and n >= b:
		if max(a, b) == n:
			c += 1
			break
		elif a < b:
			a += b
		else:
			b += a
		c += 1
	print(c)


t = int(input())
while t > 0:
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	ans = 0
	if a > b:
		while b <= n and a <= n:
			b += a
			c = b
			b = a
			a = c
			ans += 1
	else:
		while b <= n and a <= n:
			a += b
			c = a
			a = b
			b = c
			ans += 1
	print(ans)
	t -= 1


z = int(input())
ans = []
for i in range(z):
	(a, b, n) = map(int, input().split())
	f = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		f += 1
	ans.append(f)
for i in ans:
	print(i)


for t in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	minicnt = 0
	while b <= n:
		(a, b) = (max(a, b), a + b)
		minicnt += 1
	print(minicnt)


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in range(base ** n):
		s = [tb // base ** bt % base for bt in range(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()

class Tree:

	def __init__(self, inp_size=None, ls=None, init=True, index=1):
		self.LCA_init_stat = False
		self.ETtable = []
		if init:
			if ls == None:
				self.stdin(inp_size, index=index)
			else:
				self.node_size = len(ls) + 1
				(self.edges, _) = GI(self.node_size, self.node_size - 1, ls, index=index)
		return

	def stdin(self, inp_size=None, index=1):
		if inp_size == None:
			self.node_size = int(input())
		else:
			self.node_size = inp_size
		(self.edges, _) = GI(self.node_size, self.node_size - 1, index=index)
		return

	def listin(self, ls, index=0):
		self.node_size = len(ls) + 1
		(self.edges, _) = GI(self.node_size, self.node_size - 1, ls, index=index)
		return

	def dfs(self, x, func=lambda pr, prv, nx, dist: prv + dist, root_v=0):
		q = deque([x])
		v = [None] * self.node_size
		v[x] = root_v
		while q:
			c = q.pop()
			for (nb, d) in self.edges[c]:
				if v[nb] == None:
					q.append(nb)
					v[nb] = func(c, v[c], nb, d)
		return v

	def bfs(self, x, func=lambda pr, prv, nx, dist: prv + dist, root_v=0):
		q = deque([x])
		v = [None] * self.node_size
		v[x] = root_v
		while q:
			c = q.popleft()
			for (nb, d) in self.edges[c]:
				if v[nb] == None:
					q.append(nb)
					v[nb] = func(c, v[c], nb, d)
		return v

	def parent(self, x):
		return self.dfs(0, func=lambda pr, prv, nx, dist: pr, root_v=-1)

	def topological_sort(self, x):
		tps = []
		q = deque([x])
		v = [None] * self.node_size
		v[x] = 0
		while q:
			c = q.popleft()
			tps.append(c)
			for (nb, d) in self.edges[c]:
				if v[nb] == None:
					q.append(nb)
					v[nb] = 0
		return tps

	def EulerTour(self, x):
		q = deque()
		q.append(x)
		self.depth = [None] * self.node_size
		self.depth[x] = 0
		self.ETtable = []
		self.ETdepth = []
		self.ETin = [-1] * self.node_size
		self.ETout = [-1] * self.node_size
		cnt = 0
		while q:
			c = q.pop()
			if c < 0:
				ce = ~c
			else:
				ce = c
				for (nb, d) in self.edges[ce]:
					if self.depth[nb] == None:
						q.append(~ce)
						q.append(nb)
						self.depth[nb] = self.depth[ce] + 1
			self.ETtable.append(ce)
			self.ETdepth.append(self.depth[ce])
			if self.ETin[ce] == -1:
				self.ETin[ce] = cnt
			else:
				self.ETout[ce] = cnt
			cnt += 1
		return

	def doubling_LCA(self, root, x, y):
		if self.LCA_init_stat == False:
			self.depth = [None] * self.node_size
			self.depth = self.bfs(0, func=lambda pr, prv, nxt, dist: prv + 1)
			self.par = self.bfs(0, func=lambda pr, prv, nxt, dist: pr)
			self.db = [self.par]
			for i in range(self.node_size.bit_length()):
				self.db += [[self.db[-1][self.db[-1][i]] for i in range(self.node_size)]]
			self.LCA_init_stat = True
		dx = self.depth[x]
		dy = self.depth[y]
		if dx > dy:
			(dx, dy) = (dy, dx)
		c = self.node_size.bit_length()
		while c > 0:
			if dx + c <= dy:
				x = self.db[c][x]
				dx += 1 << c
			c >>= 1
		if x == y:
			return x
		c = self.node_size.bit_length()
		while c > 0:
			if self.db[c][x] != self.db[c][y]:
				x = self.db[c][x]
				y = self.db[c][y]
			c >>= 1
		return self.par[x]

	def LCA_init(self, root):
		self.EulerTour(root)
		self.st = SparseTable(self.ETdepth, init_func=min, init_idl=inf)
		self.LCA_init_stat = True
		return

	def LCA(self, root, x, y):
		if self.LCA_init_stat == False:
			self.LCA_init(root)
		(xin, xout) = (self.ETin[x], self.ETout[x])
		(yin, yout) = (self.ETin[y], self.ETout[y])
		a = min(xin, yin)
		b = max(xout, yout, xin, yin)
		id_of_min_dep_in_et = self.st.query_id(a, b + 1)
		return self.ETtable[id_of_min_dep_in_et]

	def __str__(self):
		return str(self.edges)

	def show(self):
		if all([all([d == 1 for (nd, d) in e]) for e in self.edges]):
			print([[nd for (nd, d) in e] for e in self.edges])
		else:
			print(self)

	def dfs2(self, x, func=lambda pr, prv, nx, dist: prv + dist, root_v=0):
		q = deque([x])
		v = [None] * self.node_size
		v[x] = root_v
		dfs_tr = [x]
		while q:
			c = q.pop()
			for (nb, d) in self.edges[c]:
				if v[nb] == None:
					q.append(nb)
					v[nb] = func(c, v[c], nb, d)
					dfs_tr += (nb,)
		return (v, dfs_tr)

class SparseTable:

	def __init__(self, ls, init_func=min, init_idl=float('inf')):
		self.func = init_func
		self.idl = init_idl
		self.size = len(ls)
		self.N0 = self.size.bit_length()
		self.table = [ls[:]]
		self.index = [list(range(self.size))]
		self.lg = [0] * (self.size + 1)
		for i in range(2, self.size + 1):
			self.lg[i] = self.lg[i >> 1] + 1
		for i in range(self.N0):
			tmp = [self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) for j in range(self.size)]
			tmp_id = [self.index[i][j] if self.table[i][j] == self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) else self.index[i][min(j + (1 << i), self.size - 1)] for j in range(self.size)]
			self.table += [tmp]
			self.index += [tmp_id]

	def query(self, l, r):
		if r > self.size:
			r = self.size
		N = self.lg[r - l]
		return self.func(self.table[N][l], self.table[N][max(0, r - (1 << N))])

	def query_id(self, l, r):
		if r > self.size:
			r = self.size
		N = self.lg[r - l]
		(a, b) = (self.index[N][l], self.index[N][max(0, r - (1 << N))])
		if self.table[0][a] == self.func(self.table[N][l], self.table[N][max(0, r - (1 << N))]):
			b = a
		return b

	def right_bound(self, pos, x):
		k = (self.size - pos).bit_length()
		for j in range(k)[::-1]:
			nx = pos + (1 << j)
			if nx < n and self.query(pos, nx + 1) <= x:
				pos += 1 << j
		return pos

	def left_bound(self, pos, x):
		k = pos.bit_length()
		for j in range(k)[::-1]:
			nx = pos - (1 << j)
			if 0 <= nx and self.query(nx, pos + 1) <= x:
				pos -= 1 << j
		return pos

	def __str__(self):
		return str(self.table[0])

	def print(self):
		for i in self.table:
			print(*i)
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	ans = 0
	(a, b, n) = LI()
	(a, b) = (min(a, b), max(a, b))
	c = 0
	while 1:
		if b > n:
			break
		(a, b) = (b, a + b)
		c += 1
	print(c)


answer = []
for i in range(int(input())):
	c = 0
	(a, b, n) = list(map(int, input().split()))
	m = max(a, b)
	if m > n:
		pass
	else:
		while m <= n:
			if a < b:
				a += b
			else:
				b += a
			c += 1
			m = max(a, b)
	answer.append(c)
for i in range(len(answer)):
	print(answer[i])


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	(a, b, n) = li()
	c = 0
	while a <= n and b <= n:
		(a, b) = (min(a, b), max(a, b))
		a = a + b
		c += 1
	print(c)
for _ in range(I()):
	solve()


n = int(input())
for i in range(n):
	(a, b, n) = map(int, input().split())
	l = []
	if a > b:
		i = 0
		while a < n:
			b = b + a
			(a, b) = (b, a)
			i = i + 1
		if a == n:
			print(i + 1)
		else:
			print(i)
	elif b >= a:
		i = 0
		while b < n:
			a = a + b
			(b, a) = (a, b)
			i = i + 1
		if b == n:
			print(i + 1)
		else:
			print(i)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	count = 0
	while 1:
		a1 = min(a, b)
		b1 = max(a, b)
		if b1 > c:
			break
		count += 1
		a = b1
		b = a1 + b1
	print(count)


querys = int(input())
for i in range(querys):
	(a, b, n) = map(int, input().split())
	numOp = 0
	while a < n + 1 and b < n + 1:
		if a <= b:
			a += b
			numOp += 1
		else:
			b += a
			numOp += 1
	print(numOp)


t = int(input())
a = []
b = []
n = []
for _ in range(t):
	(a1, b1, n1) = map(int, input().split())
	a.append(a1)
	b.append(b1)
	n.append(n1)
res = [-1 for _ in range(t)]
for i in range(t):
	while a[i] <= n[i] or b[i] <= n[i]:
		if a[i] <= b[i]:
			a[i] += b[i]
		else:
			b[i] += a[i]
		res[i] += 1
	print(res[i])


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	t = 1
	move = 0
	while t:
		if t % 2 == 1:
			t += 1
			a = a + b
			move += 1
		else:
			t += 1
			b = a + b
			move += 1
		if a > n or b > n:
			t = 0
			print(move)
		elif a == n or b == n:
			t = 0
			print(move + 1)


tests = int(input())
for t in range(tests):
	(a, b, n) = map(int, input().split())
	op = 0
	prev = min(a, b)
	curr = max(a, b)
	while curr <= n:
		op += 1
		nxt = prev + curr
		prev = curr
		curr = nxt
	print(op)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(maxm, minm) = (max(a, b), min(a, b))
	if maxm > n:
		print(0)
	else:
		c = 0
		while maxm <= n and minm <= n:
			c += 1
			(maxm, minm) = (maxm + minm, maxm)
		print(c)


x = int(input())
for i in range(0, x):
	m = list(map(int, input().split()))[:3]
	s = 0
	while m[0] <= m[2] and m[1] <= m[2]:
		if m[0] < m[1]:
			m[0] = m[0] + m[1]
		else:
			m[1] = m[0] + m[1]
		s = s + 1
	print(s)


t = int(input())
cases = []
for i in range(t):
	cases.append(list(map(int, input().strip().split())))

def solve(case):
	steps = 0
	(a, b, n) = case
	while a <= n and b <= n:
		steps += 1
		s = a + b
		if a < b:
			a = s
		else:
			b = s
	print(steps)
for case in cases:
	solve(case)


from math import *
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	if b > a:
		(a, b) = (b, a)
	while n >= a:
		(a, b) = (a + b, a)
		c = c + 1
	print(c)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	(big, sma) = (0, 0)
	count = 0
	if a > b:
		big = a
		sma = b
	else:
		big = b
		sma = a
	if a > n or b > n:
		print(0)
	else:
		while big < n and sma < n:
			if count % 2 == 0:
				sma += big
			else:
				big += sma
			count = count + 1
		if big == n or sma == n:
			count = count + 1
		print(count)


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	(a, b, c) = [int(x) for x in inp().split()]
	counter = 0
	if a > b:
		(a, b) = (b, a)
	while True:
		if a > c or b > c:
			break
		if counter % 2 == 0:
			a += b
		else:
			b += a
		counter += 1
	print(counter)


test = int(input())
for t in range(test):
	(a, b, n) = map(int, input().split())
	(count1, count2) = (0, 0)
	for c in range(n):
		if a > b:
			b = b + a
			count1 = count1 + 1
			if b > n:
				break
		else:
			a = a + b
			count2 = count2 + 1
			if a > n:
				break
	print(count1 + count2)


no_tests = input()
decisioinList = []
for i in range(int(no_tests)):
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	j = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		j += 1
	decisioinList.append(j)
for i in decisioinList:
	print(i)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	ans = 0
	a1 = min(a, b)
	b1 = max(a, b)
	m = n // a1 + 1
	t = True
	while a1 <= n and b1 <= n:
		a1 += b1
		ans += 1
		if a1 <= n and b1 <= n:
			b1 += a1
			ans += 1
		else:
			break
	print(ans)


import sys
input = sys.stdin.readline
from bisect import *

def linput(tt=int):
	return list(map(tt, input().split()))

def gcd(a: int, b: int):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def main():
	Q = int(input())
	vR = []
	for _ in range(Q):
		(A, B, N) = linput()
		R = 0
		(x, y) = (min(A, B), max(A, B))
		while y <= N:
			x += y
			(x, y) = (min(x, y), max(x, y))
			R += 1
		vR.append(R)
	print(*vR, sep='\n')
main()


for __ in range(int(input())):
	(intA, intB, intN) = map(int, input().split())
	count = 0
	while intA <= intN or intB <= intN:
		minA = min(intA, intB)
		maxB = max(intA, intB)
		minA += maxB
		intA = minA
		intB = maxB
		count += 1
	print(count - 1)


n_cases = int(input())
cases = []
for i in range(n_cases):
	cases.append(input())

def smallest_number_of_additions(a, b, c):
	n_additions = 0
	while a <= c and b <= c:
		if a > b:
			b = b + a
			n_additions = n_additions + 1
		else:
			a = a + b
			n_additions = n_additions + 1
	return n_additions
for i in range(n_cases):
	case = cases[i].split(' ')
	print(smallest_number_of_additions(int(case[0]), int(case[1]), int(case[2])))


import time, math, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x))

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count

def solve():
	(a, b, n) = IP()
	(x, y) = (max(a, b), min(a, b))
	mov = 0
	while x <= n:
		y += x
		(x, y) = (max(x, y), min(x, y))
		mov += 1
	print(mov)
t = II()
for i in range(t):
	solve()


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	(a, b, N) = MAP()
	if a > b:
		(a, b) = (b, a)
	dp = [0] * 1000
	dp[0] = a
	dp[1] = b
	i = 1
	while dp[i] <= N:
		dp[i + 1] = dp[i] + dp[i - 1]
		i += 1
	ans = i - 1
	print(ans)


def larger(a, b):
	if a >= b:
		return a
	return b

def c(a, b, n):
	pre = larger(a, b)
	current = a + b
	i = 1
	while current <= n:
		p = current
		current = pre + current
		pre = p
		i = i + 1
	return i
n = int(input())
l = []
for i in range(n):
	(a, b, n) = [int(x) for x in input().split()]
	d = c(a, b, n)
	l.append(d)
for x in l:
	print(x)


import math
import bisect
from sys import stdin
from collections import Counter, defaultdict, deque
input = stdin.readline
mod = pow(10, 9) + 7

def solve():
	(a, b, n) = map(int, input().split())
	x = max(a, b)
	if x > n:
		print(0)
		return
	f1 = min(a, b)
	f2 = max(a, b)
	c = 0
	while 1:
		c = c + 1
		f3 = f1 + f2
		f1 = f2
		f2 = f3
		if f3 > n:
			print(c)
			return
for _ in range(int(input())):
	solve()


from math import ceil
t = int(input())
fn = [0, 1]
for i in range(t):
	(a, b, n) = [int(x) for x in input().split(' ')]
	t1 = a + b
	t2 = max(a, b)

	def test(x):
		for j in range(max(x - len(fn) + 2, 0)):
			fn.append(fn[-1] + fn[-2])
		return fn[x] * t1 + fn[x - 1] * t2
	j = 1
	while True:
		if test(j) > n:
			print(j)
			break
		j += 1


t = int(input())
while t:
	(a, b, n) = map(int, input().split())
	r = max(a, b)
	m = min(a, b)
	(b, a) = (r, m)
	it = 0
	adda = 0
	addb = 1
	while a <= n and b <= n:
		if addb == 1:
			a = a + b
			addb = 0
			adda = 1
			it = it + 1
		elif adda == 1:
			b = b + a
			adda = 0
			addb = 1
			it = it + 1
	print(it)
	t = t - 1


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	fa = 1
	fb = 0
	sa = 0
	sb = 1
	for q in range(1, 100):
		if fa * a + fb * b > sa * a + sb * b:
			sa += fa
			sb += fb
		else:
			fa += sa
			fb += sb
		if a * fa + b * fb > n or a * sa + b * sb > n:
			print(q)
			break


for _ in range(int(input())):
	(s, count) = (0, 0)
	(i, j, n) = map(int, input().split())
	a = min(i, j)
	b = max(i, j)
	while not s > n:
		s = a + b
		a = min(s, b)
		b = max(s, b)
		count += 1
	else:
		print(count)


tc = int(input())
for cn in range(tc):
	(a, b, k) = map(int, input().split())
	cnt = int()
	if a > b:
		(a, b) = (b, a)
	while a <= k and b <= k:
		a += b
		cnt += 1
		if a <= k:
			b += a
			cnt += 1
	print(cnt)


def solve():
	(a, b, n) = [int(i) for i in input().split()]
	res = 0
	while a <= n and b <= n:
		x = min(a, b)
		y = max(a, b)
		a = x + y
		b = y
		res += 1
	print(res)
t = int(input())
for _ in range(t):
	solve()


T = int(input())
answer = []
for i in range(T):
	arr = [int(j) for j in input().split()]
	a = arr[0]
	b = arr[1]
	n = arr[2]
	p = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		p += 1
	print(p)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	d = 0
	for i in range(c):
		s = min(a, b)
		if max(a, b) <= c:
			d += 1
			if s == a:
				a = a + b
			else:
				b = b + a
		else:
			break
	print(d)


tc = int(input())
for _ in range(tc):
	(a, b, n) = list(map(int, input().rstrip().split()))
	cnt = 0
	while max(a, b) <= n:
		(a, b) = (a + b, max(a, b))
		cnt += 1
	print(cnt)


from collections import defaultdict, Counter
import copy, math
from copy import deepcopy
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	s = 0
	while a <= n and b <= n:
		if a > b:
			(a, b) = (b, a)
		s += 1
		a += b
	print(s)


n = int(input())

def fu(a, b, c):
	g = 0
	p = min(a, b)
	q = max(a, b)
	for i in range(10000000000):
		if p > c or q > c:
			break
		if i % 2 == 0:
			p += q
			g += 1
		else:
			q += p
			g += 1
	return g
for i in range(n):
	(a, b, c) = list(map(int, input().split()))
	print(fu(a, b, c))


import math
t = int(input())
for _ in range(t):
	c = 0
	(a, b, n) = list(map(int, input().split()))
	while max(a, b) <= n:
		if a <= b:
			a += b
		else:
			b += a
		c += 1
	print(c)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(a, b, n) = list(map(int, input().split()))
		(c, d) = (min(a, b), max(a, b))
		counter = 0
		while max(c, d) <= n:
			(e, f) = (min(c, d), max(c, d))
			(c, d) = (e + f, f)
			counter += 1
		yield counter
t = int(input())
ans = gift()
print(*ans, sep='\n')


t = int(input())
while t > 0:
	t += -1
	(a, b, n) = [int(i) for i in input().split()]
	op = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		op += 1
	print(op)


def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	(a, b, n) = read_ints()
	if a < b:
		(a, b) = (b, a)
	count = 0
	while a <= n:
		(a, b) = (a + b, a)
		count += 1
	return count
T = read_int()
for _ in range(T):
	print(solve())


import sys, math
input = lambda : sys.stdin.readline().rstrip()
for __ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans = 0
	while a <= n and b <= n:
		a += b
		b += a
		ans += 2
	if a > n:
		ans -= 1
	print(ans)


z = input
from math import ceil, gcd, log
n = int(z())
for i in range(n):
	(a, b, n) = list(map(int, input().split(' ')))
	m = min(a, b)
	h = max(a, b)
	c = 0
	d = 0
	while True:
		i = h
		h += m
		c += 1
		m = i
		if h > n:
			print(c)
			d = 1
			break


T = int(input())
for i in range(T):
	(a, b, n) = [int(x) for x in input().split()]
	if a is None or b is None:
		continue
	count = 0
	while a <= n:
		if b > a or a + b > n:
			a += b
		else:
			b += a
		count += 1
	print(count)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(a, b, n) = I()
	an = 0
	while 1:
		if a > b:
			(a, b) = (b, a)
		if a > n or b > n:
			break
		an += 1
		a += b
	print(an)


t = int(input())
for j in range(t):
	(a, b, n) = [int(a) for a in input().split()]
	r = 0
	while a <= n or b <= n:
		if a > b:
			b += a
			r += 1
		else:
			a += b
			r += 1
	print(r - 1)


for __ in range(int(input())):
	(a1, b1, n) = map(int, input().split())
	(a, b, ans) = (max(a1, b1), min(a1, b1), 0)
	while a <= n and b <= n:
		temp = a
		a = a + b
		b = temp
		ans += 1
	print(ans)


t = int(input())
for jack in range(t):
	(a, b, n) = map(int, input().split())
	r = 0
	while not (a > n or b > n):
		if b < a:
			(a, b) = (b, a)
		a += b
		r += 1
	print(r)


T = int(input())

def solve():
	[A, B, N] = list(map(int, input().split()))

	def do(A, B):
		ans = 0
		while A <= N and B <= N:
			if ans % 2 == 0:
				A += B
			else:
				B += A
			ans += 1
		return ans
	return min(do(A, B), do(B, A))
for _ in range(T):
	print(solve())


t = int(input())
for o in range(t):
	(a, b, c) = map(int, input().split())
	p = 0
	while a <= c and b <= c:
		if a < b:
			a += b
		else:
			b += a
		p += 1
	print(p)


import sys
import math as mt
input = sys.stdin.buffer.readline
t = int(input())
for __ in range(t):
	(a, b, n) = map(int, input().split())
	ans = 0
	maxi = max(a, b)
	mini = min(a, b)
	ch = 0
	while maxi <= n:
		mini1 = maxi
		maxi += mini
		mini = mini1
		ans += 1
		ch += 1
	print(ans)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split(' '))
	d = max(a, b)
	e = min(a, b)
	count = 0
	while d <= n and e <= n:
		if d < e:
			d += e
		else:
			e += d
		count += 1
	print(count)


def main():
	t = int(input())
	l = []
	while t > 0:
		m = []
		msg = input()
		lista = msg.split()
		m.append(int(lista[0]))
		m.append(int(lista[1]))
		m.append(int(lista[2]))
		l.append(m)
		t -= 1
	for m in l:
		a = m[0]
		b = m[1]
		n = m[2]
		c = 0
		while a <= n and b <= n:
			if a > b:
				b += a
				c += 1
			else:
				a += b
				c += 1
		print(c)
main()


m = 10 ** 9 + 7
t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	count = 0
	while a <= n and b <= n:
		if a >= b:
			b += a
		elif a < b:
			a += b
		count += 1
	print(count)


from sys import stdin, stdout
inp = stdin.readline
op = stdout.write
t = int(inp())
ans = []
for _ in range(t):
	(a, b, n) = list(map(int, inp().split()))
	count = 0
	while a <= n and b <= n:
		if a + b > n:
			count = count + 1
			break
		if a > b:
			b += a
		else:
			a += b
		count = count + 1
	ans.append(str(count))
op('\n'.join(ans))


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	l = [max(a, b), a + b]
	for j in range(10000):
		if l[-1] > n:
			print(j + 1)
			break
		l.append(l[-1] + l[-2])


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	d = []
	c = b
	e = []
	g = a
	h = b
	for i in range(n):
		b = a
		a += c
		c = b
		d.append(a)
		if a > n:
			break
	for i in range(n):
		a = h
		h += g
		g = a
		e.append(h)
		if h > n:
			break
	print(min(len(e), len(d)))


t = int(input())
for test in range(t):
	(a, b, n) = [int(i) for i in input().split()]
	l = max(a, b)
	r = min(a, b)
	count = 0
	while l <= n:
		temp = l
		l = r + l
		r = temp
		count += 1
	print(count)


number = int(input())
for i in range(number):
	counter = 0
	(a, b, t) = map(int, input().split())
	while a <= t and b <= t:
		if a < b:
			a += b
		else:
			b += a
		counter += 1
	print(counter)


t = int(input())
for _ in range(t):
	(a, b, n) = [int(s) for s in input().split()]
	ma = max(a, b)
	mi = min(a, b)
	cnt = 0
	while ma <= n and mi <= n:
		mi = ma + mi
		cnt += 1
		if mi > n:
			print(cnt)
			break
		else:
			ma = mi + ma
			cnt += 1
			if ma > n:
				print(cnt)
				break


for x in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	i = 0
	count = 0
	while a <= n or b <= n:
		s = min(a, b)
		if s == a:
			a += b
		else:
			b += a
		count += 1
		i += 1
	print(count - 1)


T = int(input())
nums = []
for i in range(T):
	nums.append([int(x) for x in input().split()])
output = []
for num in nums:
	a = num[0]
	b = num[1]
	n = num[2]
	counter = 1
	while a + b <= n:
		tmp = max(a, b)
		b = min(a, b)
		a = tmp
		b += a
		counter += 1
	output.append(counter)
for x in output:
	print(x)


import sys
input = sys.stdin.readline
from math import ceil

def solve(a, b, n):
	if a > n or b > n:
		return 0
	ops = 0
	while a <= n or b <= n:
		ops += 1
		if a > b:
			b += a
		else:
			a += b
	return ops - 1
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	print(solve(a, b, n))


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	counter = 0
	while True:
		if a > n or b > n:
			break
		else:
			if a > b:
				b += a
			else:
				a += b
			counter += 1
	print(counter)


import os
import sys
from io import BytesIO, IOBase
import threading
from math import floor
from collections import Counter
from math import gcd
mod = 998244353

def main():
	for _ in range(int(input())):
		(a, b, n) = map(int, input().split())
		cnt = 0
		(a, b) = (max(a, b), min(a, b))
		while True:
			if n < a:
				break
			cnt += 1
			(a, b) = (a + b, a)
		print(cnt)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().strip().split())
	(a, b) = (min(a, b), max(a, b))
	counter = 0
	while b <= n:
		a += b
		(a, b) = (b, a)
		counter += 1
	print(counter)


I = lambda : list(map(int, input().split(' ')))
J = lambda : int(input())
global mem
mem = [0, 1, 2]

def fib(n):
	if n == 0 or n == 1 or n == 2:
		return mem[n]
	elif len(mem) - 1 >= n:
		return mem[n]
	else:
		mem.append(fib(n - 1) + fib(n - 2))
		return mem[n]

def f(a, b, n):
	if a > n or b > n:
		print(0)
	elif a + b > n:
		if a + b > n:
			print(1)
	else:
		k = 2
		while fib(k) * a + fib(k - 1) * b <= n:
			k += 1
		print(k)
for _ in range(J()):
	(a, b, n) = I()
	(a, b) = (max(a, b), min(a, b))
	f(a, b, n)


q = int(input())
for _ in range(q):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while True:
		(a, b) = (min(a, b), max(a, b))
		if b > n:
			break
		a += b
		cnt += 1
	print(cnt)


t = int(input())
while t:
	t = t - 1
	(a, b, n) = map(int, input().split())
	f1 = min(a, b)
	f2 = max(a, b)
	cnt = 0
	while f2 <= n:
		x = f2
		f2 = f1 + f2
		f1 = x
		cnt += 1
	print(cnt)


from collections import *
from math import *

def get_input_array(element_data_type):
	arr = list(map(element_data_type, input().split()))
	return arr

def solve():
	(a, b, n) = map(int, input().split())
	ans = 0
	arr = [max(a, b), max(a, b) + min(a, b)]
	if arr[0] > n:
		return 0
	if arr[1] > n:
		return 1
	while arr[-1] <= n:
		arr.append(arr[-1] + arr[-2])
	return len(arr) - 1

def main():
	t = int(input())
	test_case_number = 1
	while test_case_number <= t:
		print(solve())
		test_case_number += 1
main()


cases = int(input())
for i in range(cases):
	l1 = input().split(' ')
	a = int(l1[0])
	b = int(l1[1])
	n = int(l1[2])
	steps = 0
	if max(a, b) > n:
		print(0)
		continue
	while max(a, b) <= n:
		temp = a + b
		b = max(a, b)
		a = temp
		steps += 1
	print(steps)


t = int(input())
for i in range(t):
	(a, b, n) = input().split(' ')
	(a, b, n) = (int(a), int(b), int(n))
	soma = a + b
	cont = 1
	while soma <= n:
		(a, b) = (soma, max(a, b))
		soma = a + b
		cont += 1
	print(cont)


t = int(input())
li = []
for i in range(t):
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	count = 0
	while a + b <= n:
		if a > b:
			b = a + b
		else:
			a = a + b
		count = count + 1
	li.append(count + 1)
for i in li:
	print(i)


import sys
import math
t = int(sys.stdin.readline())
for _ in range(t):
	(a, b, n) = map(int, sys.stdin.readline().split())
	y = max(a, b)
	z = min(a, b)
	ans = 0
	t = y
	for i in range(10 ** 6):
		if y > n:
			print(ans)
			break
		ans += 1
		y += z
		z = t
		t = y


for i in range(int(input())):
	(x, y, n) = map(int, input().split())
	count = 0
	count = 0
	while x <= n and y <= n:
		if x < y:
			x += y
		else:
			y += x
		count += 1
	print(count)


T = int(input())
for t in range(T):
	(A, B, N) = [int(_) for _ in input().split()]
	(A, B) = (min(A, B), max(A, B))
	op = 0
	while A <= N and B <= N:
		A += B
		op += 1
		if A > N:
			break
		B += A
		op += 1
	print(op)


for _ in range(int(input())):
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	ma = max(a, b)
	mi = min(a, b)
	ans = 0
	i = 0
	while ma <= n and mi <= n:
		ans += 1
		if i == 0:
			mi = mi + ma
			i = 1
		else:
			ma = ma + mi
			i = 0
	print(ans)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	x = [min(a, b), max(a, b)]
	count = 0
	i = 1
	while True:
		val = x[i] + x[i - 1]
		count += 1
		if val > n:
			break
		x.append(val)
		i += 1
	print(count)


from sys import stdin
t = int(stdin.readline())
for i in range(t):
	count = 0
	(a, b, n) = map(int, stdin.readline().split())
	while True:
		if a > b:
			if a > n or b > n:
				break
			b += a
			count += 1
		else:
			if a > n or b > n:
				break
			a += b
			count += 1
	print(count)


for I in range(int(input())):
	(a, b, n) = map(int, input().split())
	res = 0
	while 1:
		res += 1
		(a, b) = (min(a, b) + max(a, b), max(a, b))
		if a > n:
			break
	print(res)


n = int(input())
for i in range(n):
	k = list(map(int, input().split()))
	c = 1
	t = max(k[0], k[1])
	s = min(k[0], k[1])
	r = t + s
	for i in range(50):
		if r > k[2]:
			print(c)
			break
		else:
			s = t
			t = r
			r = s + t
			c += 1


def fibo(a):
	for i in range(2, 100):
		a[i] = a[i - 1] + a[i - 2]
	return a
a = [1] * 100
a = fibo(a)
b = [1] * 100
b[1] = 2
b = fibo(b)
for _ in range(int(input())):
	(d, e, f) = map(int, input().split())
	g = max(d, e)
	h = min(d, e)
	rs = 0
	while True:
		if h * a[rs] + g * b[rs] > f:
			print(rs + 1)
			break
		rs += 1


t = int(input())
for i in range(t):
	(a, b, n) = [int(j) for j in input().split()[:3]]
	cnt = 0
	while a <= n and b <= n:
		if a > b:
			b += a
			cnt += 1
		else:
			a += b
			cnt += 1
	print(cnt)


def C(T):
	for i in range(T):
		(a, b, n) = map(int, input().split())
		wynik = 1
		while min(a, b) + max(a, b) <= n:
			if b > a:
				a += b
			else:
				b += a
			wynik += 1
		print(wynik)
C(int(input()))


q = int(input())
p = 1
while p <= q:
	(a, b, n) = map(int, input().split())
	k = max(a, b)
	l = min(a, b)
	count = 0
	m = n
	while m > 0:
		if k <= n and l <= n:
			l += k
			count += 1
		if k <= n and l <= n:
			k += l
			count += 1
		elif k > n or l > n:
			print(count)
			break
		m -= 1
	p += 1


def main():
	t = eval(input())
	for i in range(t):
		(a, b, n) = map(int, input().split(' '))
		list2 = []
		if a > b:
			list2.append(b)
			list2.append(a)
		else:
			list2.append(a)
			list2.append(b)
		list2.append(a + b)
		count = 1
		listcount = 2
		while list2[listcount] <= n:
			list2.append(list2[count] + list2[count + 1])
			listcount = listcount + 1
			count = count + 1
		print(len(list2) - 2)
main()


t = int(input())
while t > 0:
	abn = list(map(int, input().split()))
	a = abn[0]
	b = abn[1]
	n = abn[2]
	cnt = 0
	t = t - 1
	while max(a, b) <= n:
		if a > b:
			b = a + b
			cnt = cnt + 1
		else:
			a = a + b
			cnt = cnt + 1
	print(cnt)


test = int(input())
test_arr = []
for _ in range(test):
	(a, b, n) = map(int, input().split())
	m = max(a, b)
	if m <= n:
		start = a + b
		count = 1
		while start <= n:
			i = max(start, m)
			start += m
			m = i
			count += 1
	else:
		count = 0
	test_arr.append(count)
for t in test_arr:
	print(t)


t = int(input())
for i in range(t):
	ans = 0
	(a, b, n) = map(int, input().split())
	if a > n or b > n:
		print(0)
	elif a + b > n:
		print(1)
	else:
		while True:
			if a < b:
				a = a + b
			else:
				b = a + b
			ans += 1
			if max(a, b) > n:
				print(ans)
				break


x = int(input())
for i in range(x):
	(a, b, n) = list(map(int, input().split()))
	i = 0
	if b > a:
		(a, b) = (b, a)
	while a <= n:
		b = a + b
		if b > a:
			(a, b) = (b, a)
		i = i + 1
	print(i)


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
t = int(input())
for test in range(t):
	(a, b, n) = get_ints()
	x = max(a, b)
	y = min(a, b)
	no = 0
	while max(x, y) <= n:
		p = min(x, y)
		q = max(x, y)
		p += q
		x = min(p, q)
		y = max(p, q)
		no += 1
	print(no)


for _ in range(int(input())):
	(h, b, n) = map(int, input().split())
	c = 0
	while not (h > n or b > n):
		if h < b:
			h += b
		else:
			b += h
		c += 1
	print(c)


import sys

def find_operation_sequence(a, b, n, count):
	if a <= b and b <= n:
		return find_operation_sequence(a + b, b, n, count + 1)
	if b < a and a <= n:
		return find_operation_sequence(a, b + a, n, count + 1)
	return count

def minimum_operations(a, b, n):
	return find_operation_sequence(a, b, n, 0)
T = int(input())
for k in range(T):
	(a, b, n) = map(int, sys.stdin.readline().split())
	print(minimum_operations(a, b, n))


for i in range(int(input())):
	b = list(map(int, input().strip().split()))[:3]
	count = 0
	while b[0] <= b[2] and b[1] <= b[2]:
		if b[0] < b[1]:
			b[0] = b[0] + b[1]
		else:
			b[1] = b[0] + b[1]
		count += 1
	print(count)


def my_function(x, y, z):
	count = 0
	while x + y <= z:
		if x < y:
			x += y
		else:
			y += x
		count += 1
	return count + 1
t = int(input())
while t > 0:
	inputs = list(map(int, input().split()))
	print(my_function(inputs[0], inputs[1], inputs[2]))
	t -= 1


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	cf = 1
	pf = 1
	ppf = 0
	ac = 0
	while a * ppf + b * cf <= n:
		ac += 1
		cf = pf + ppf
		ppf = pf
		pf = cf
	print(ac)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def instr():
	return str(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
from collections import Counter

def main():
	t = inp()
	for _ in range(t):
		(a, b, n) = inlt()
		res = 0
		while True:
			if a + b > n:
				print(res + 1)
				break
			if a < b:
				a += b
			else:
				b += a
			res += 1
main()


t = int(input())
while t:
	t -= 1
	(a, b, n) = list(map(int, input().strip(' ').split(' ')))
	big = max(a, b)
	small = min(a, b)
	count = 0
	while True:
		if big > n:
			break
		else:
			small += big
			(big, small) = (small, big)
			count += 1
	print(count)


import sys
read = lambda : sys.stdin.readline()
T = int(read())
for t in range(T):
	(a, b, n) = map(int, read().split())
	c = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		c += 1
	print(c)


def ans(a, b, n):
	if max(a, b) > n:
		return 0
	return 1 + ans(a + b, max(a, b), n)
T = int(input())
for _ in range(T):
	(a, b, n) = input().split(' ')
	a = int(a)
	b = int(b)
	n = int(n)
	print(ans(a, b, n))


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from collections import Counter as cc
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while a <= n and b <= n:
		(a, b) = (min(a, b), max(a, b))
		(a, b) = (a + b, b)
		cnt += 1
	print(cnt)


from sys import stdin, stdout

def II():
	return int(stdin.readline())

def MI():
	return map(int, stdin.readline().split())
q = int(input())
for _ in range(q):
	(a, b, n) = map(int, input().split(' '))
	ans = 0
	if b > a:
		(a, b) = (b, a)
	while a <= n and b <= n:
		if ans % 2 == 0:
			b += a
		else:
			a += b
		ans += 1
	stdout.write(str(ans) + '\n')


l = []
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	x = 0
	while a <= n and b <= n:
		if a > b:
			b = b + a
			x = x + 1
		elif b > a:
			a = a + b
			x = x + 1
		else:
			a = a + b
			x = x + 1
	l.append(x)
for i in range(len(l)):
	print(l[i])


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(a, b, n) = value()
	(a, b) = sorted((a, b))
	if b > n:
		print(0)
		continue
	ans = [a, b]
	c = 0
	for i in range(10000):
		c += 1
		ans = a + b
		a = b
		b = ans
		if ans > n:
			print(c)
			break


import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def main():
	ntc = next(ints)
	for tc in range(1, ntc + 1):
		(a, b, n) = (next(ints) for i in range(3))
		ans = 0
		while a <= n and b <= n:
			(a, b) = (max(a, b), a + b)
			ans += 1
		print(ans)
	return
main()


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	count = 0
	while a <= c and b <= c:
		if a < b:
			a += b
			count += 1
		else:
			b += a
			count += 1
	print(count)


def A():
	n = int(input())
	for i in range(n):
		line = input()
		arr = list(map(int, line.split(' ')))
		taskA(arr[0], arr[1], arr[2])

def taskA(a, b, n):
	answer = 0
	if b < a:
		(a, b) = (b, a)
	while a <= n and b <= n:
		if answer % 2 == 0:
			a += b
		else:
			b += a
		answer += 1
	print(answer)
A()


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = int(stdin.readline())
for _ in range(t):
	(a, b, n) = list(map(int, stdin.readline().rstrip().split()))
	cnt = 0
	if a > b:
		(a, b) = (b, a)
	i = 0
	while max(a, b) <= n:
		if i % 2 == 0:
			a += b
		else:
			b += a
		i += 1
	print(i)


from sys import stdout, stdin
(_input, _print) = (stdin.readline, stdout.write)
(_range, _int) = (range, int)

def solution():
	for _ in _range(_int(_input())):
		(a, b, n) = [_int(i) for i in _input().split()]
		c = 0
		while n >= a and n >= b:
			c += 1
			if a > b:
				b += a
			else:
				a += b
		print(c)
solution()


def solution(query):
	(a, b, target) = query
	i = 0
	while a <= target:
		aux = max(a, b)
		a = min(a, b) + aux
		b = aux
		i += 1
	return i
n = int(input())
for i in range(n):
	query = list(map(int, input().split()))
	print(solution(query))


t = int(input())

def fun(a, b, n):
	ans = 0
	while max(a, b) <= n:
		(a, b) = (min(a, b), max(a, b))
		a += b
		ans += 1
	print(ans)
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	fun(a, b, n)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	ans = 0
	M = max(a, b)
	while n >= M:
		if a + b + b > a + (a + b):
			a += b
		else:
			b += a
		M = max(a, b)
		ans += 1
	print(ans)


for t in range(int(input())):
	(a, b, n) = map(int, input().split(' '))
	mi = min(a, b)
	mx = max(a, b)
	c = 0
	while mx <= n:
		t = mx
		mx = mx + mi
		mi = t
		c += 1
	print(c)


def res(a, b):
	if a > b:
		return (a, a + b)
	else:
		return (a + b, b)
for _ in range(int(input())):
	(a, b, n) = (int(x) for x in input().split())
	yoo = 0
	while a <= n and b <= n:
		(a, b) = res(a, b)
		yoo += 1
	print(yoo)


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	c = 0
	while 1:
		if a > n or b > n:
			break
		if a > b:
			(a, b) = (b, a)
		a = a + b
		c += 1
	print(c)


n = int(input())
for i in range(n):
	(a, b, x) = map(int, input().split())
	b1 = max(a, b)
	a1 = min(a, b)
	count = 0
	while 1:
		a1 += b1
		count += 1
		if a1 > x:
			break
		b1 += a1
		count += 1
		if b1 > x:
			break
	print(count)


t = int(input())
for _ in range(t):
	abn = list(map(int, input().split()))
	s = 0
	cnt = 0
	while s <= abn[2]:
		s = abn[0] + abn[1]
		if abn[0] < abn[1]:
			abn[0] = abn[0] + abn[1]
		else:
			abn[1] = abn[0] + abn[1]
		cnt += 1
	print(cnt)


def problem1():
	(a, b, n) = list(map(int, input().split()))
	if a < b:
		a = a + b
		b = a - b
		a = a - b
	c = 0
	while a <= n:
		a = a + b
		b = a - b
		c += 1
	print(c)
cases = int(input())
for _ in range(cases):
	problem1()


t = int(input())
for i in range(t):
	p = input().split()
	(a, b, n) = (int(p[0]), int(p[1]), int(p[2]))
	i = 0
	while not (not a <= n or not b <= n):
		if a < b:
			a += b
			i += 1
		elif b < a:
			b += a
			i += 1
		elif a == b:
			a += b
			i += 1
	print(i)


def foo(a, b, n):
	if a > n or b > n:
		return 0
	if a > b:
		return 1 + foo(a, a + b, n)
	else:
		return 1 + foo(a + b, b, n)
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	chk = foo(a, b, n)
	print(chk)


t = int(input())
while t:
	(a, b, n) = map(int, input().split())
	r = max(a, b)
	s = min(a, b)
	if a + b > n:
		print('1')
	else:
		temp = a + b
		res = r
		c = 1
		while 1:
			tem = temp
			temp += res
			res = tem
			c += 1
			if temp > n:
				break
		print(c)
	t -= 1


testcases = int(input())
for i in range(testcases):
	(a, b, n) = map(int, input().split())
	addition = a + b
	count = 1
	while addition <= n:
		if a < b:
			a = addition
		else:
			b = addition
		addition = a + b
		count += 1
	print(count)


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	count = 0
	flag = 0
	if a > b:
		flag = 1
	else:
		flag = 0
	while a <= n and b <= n:
		if flag == 0:
			a += b
			count += 1
			flag = 1
		elif flag == 1:
			b += a
			count += 1
			flag = 0
	print(count)


t = int(input())
for _ in range(t):
	(a, b, n) = (int(var) for var in input().split())
	(maxi, mini) = (max(a, b), min(a, b))
	if a > n or b > n:
		print(0)
	else:
		import math
		steps = 0
		while not (maxi > n or mini > n):
			(maxi, mini) = (max(maxi, mini), min(maxi, mini))
			mini += maxi
			steps += 1
		print(steps)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	a1 = a2 = a
	b1 = b2 = b
	cnt1 = 0
	i = 0
	while a1 <= n and b1 <= n:
		if i % 2 == 0:
			a1 += b1
			cnt1 += 1
			i += 1
		else:
			b1 += a1
			i += 1
			cnt1 += 1
	cnt2 = 0
	i = 0
	while a2 <= n and b2 <= n:
		if i % 2 == 1:
			a2 += b2
			cnt2 += 1
			i += 1
		else:
			b2 += a2
			i += 1
			cnt2 += 1
	print(min(cnt1, cnt2))


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	(a, b, n) = map(int, I().split())
	cnt = 0
	while a <= n and b <= n:
		cnt += 1
		if a < b:
			a += b
		else:
			b += a
	ans += str(cnt) + '\n'
print(ans)


t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	c = max(a, b)
	i = min(a, b)
	a = c
	b = i
	c = i = 0
	while a <= n and b <= n:
		if a + b > n:
			c += 1
			break
		if i % 2 == 0:
			b += a
			i += 1
		else:
			a += b
			i += 1
		c += 1
	print(c)


import math
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	count = 0
	while not (a > n or b > n):
		if a > b:
			b += a
		else:
			a += b
		count += 1
	print(count)


n = int(input())
for i in range(n):
	abc = input().split()
	a = int(abc[0])
	b = int(abc[1])
	counter = 0
	while b <= int(abc[-1]):
		(a, b) = (max(a, b), a + b)
		counter += 1
	print(counter)


t = int(input())
for tt in range(t):
	(a, b, n) = [int(x) for x in input().split(' ')]
	m = min(a, b)
	M = max(a, b)
	cnt = 0
	while max(m, M) <= n:
		if cnt % 2 == 0:
			m += M
		else:
			M += m
		cnt += 1
	print(cnt)


def solve():
	(a, b, n) = map(int, input().split())
	ans = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)
[solve() for _ in range(int(input()))]


for t in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 0
	s = 0
	k = max(a, b)
	p = min(a, b)
	a = p
	b = k
	while s <= n:
		s = a + b
		a = b
		b = s
		c += 1
	print(c)


from math import *
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	f = 0
	while a <= n and b <= n:
		m = max(a, b)
		mn = min(a, b)
		if mn == a:
			a += m
		else:
			b += m
		f += 1
	print(f)


T = int(input())
for t in range(T):
	(a, b, c) = map(int, input().split())
	ans = 0
	while a <= c and b <= c:
		if a >= b:
			b += a
		else:
			a += b
		ans += 1
	print(ans)


test_case = int(input())
for _ in range(test_case):
	(*a, n) = map(int, input().split())
	a.sort()
	i = 0
	while a[0] <= n and a[1] <= n:
		a[i % 2] += a[(i + 1) % 2]
		i += 1
	print(i)


T = int(input())

def getFibo(k):
	phi = (1 + pow(5, 0.5)) / 2
	ksi = (1 - pow(5, 0.5)) / 2
	if k == 0 or k == 1 or k == 2:
		return 1
	return (phi ** k - ksi ** k) / (phi - ksi)

def Fibo2(n, m):
	if n == 1 or n == 0:
		return 1
	if n not in m:
		m[n] = Fibo2(n - 1, m) + Fibo2(n - 2, m)
	return m[n]
m = {}
while T > 0:
	(a, b, n) = [int(el) for el in input().split(' ')]
	bb = max(a, b)
	aa = min(a, b)
	if bb > n:
		print(0)
	else:
		for i in range(0, 51):
			if aa * Fibo2(i, m) + bb * Fibo2(i + 1, m) > n:
				print(i + 1)
				break
	T -= 1


casos = int(input())
for i in range(casos):
	entrada = input().split()
	a = int(entrada[0])
	b = int(entrada[1])
	n = int(entrada[2])
	menor = a
	maior = b
	if a > b:
		menor = b
		maior = a
	response = []
	response.append(menor)
	response.append(maior)
	while response[-1] <= n:
		response.append(response[-1] + response[-2])
	print(len(response) - 2)


t = int(input())
sum = 0
for i in range(t):
	(a, b, c) = map(int, input().split())
	while a <= c and b <= c:
		if a < b:
			a += b
			sum += 1
		elif a >= b:
			(a, b) = (b, a)
			a += b
			sum += 1
	print(sum)
	sum = 0


tests = int(input())
for i in range(tests):
	args = [int(arg) for arg in input().split()]
	(a, b, n) = (args[0], args[1], args[2])
	count = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	print(count)


x = int(input())

def solution(a, b, n):
	count = 0
	while (a <= n) | (b <= n):
		if (a + b > n) | (b + a > n):
			count += 1
			return count
		if a <= b:
			a += b
		else:
			b += a
		count += 1
while x != 0:
	ss = input()
	ss = ss.split(' ')
	a = int(ss[0])
	b = int(ss[1])
	n = int(ss[2])
	print(solution(a, b, n))
	x -= 1


t = int(input())
while t != 0:
	(a, b, n) = input().split()
	c = 1
	while 1:
		y = max(int(a), int(b))
		p = int(a) + int(b)
		a = y
		b = p
		if p <= int(n):
			c = c + 1
		else:
			break
	print(c)
	t = t - 1


t = int(input())
lis = []
for i in range(t):
	(a, b, c) = input().split()
	lis.append([int(a), int(b), int(c)])
for (i, j, k) in lis:
	m = i
	n = j
	count = 0
	while m <= k and n <= k:
		if m <= n:
			m += n
		else:
			n += m
		count += 1
	print(count)


testes = int(input())
for i in range(testes):
	dados = input().split()
	a = int(dados[0])
	b = int(dados[1])
	n = int(dados[2])
	contador = 0
	while True:
		if a >= b:
			b += a
			contador += 1
		else:
			a += b
			contador += 1
		if a > n or b > n:
			break
	print(contador)


t = int(input())
while t:
	(a, b, n) = map(int, input().split())
	cn = 0
	while a <= n and b <= n:
		if a >= b:
			b += a
			cn += 1
		elif b > a:
			a += b
			cn += 1
	print(cn)
	t -= 1


for _ in range(int(input())):
	(a1, b1, n) = list(map(int, input().split()))
	a = min(a1, b1)
	b = max(a1, b1)
	s = 0
	count = 0
	while not s > n:
		s = a + b
		(a, b) = (b, s)
		count += 1
	print(count)


for i in range(int(input())):
	(a, b, n) = input().split()
	(a, b, n) = (int(a), int(b), int(n))
	(a, b) = (min(a, b), max(a, b))
	steps = i = 0
	while a <= n and b <= n:
		if i % 2 == 0:
			a += b
		else:
			b += a
		i += 1
		steps += 1
	print(steps)


t = int(input())
for gsdagsa in range(t):
	res = 0
	(a, b, n) = list(map(int, input().split()))
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		res += 1
		if max(a, b) > n:
			break
	print(res)


t = int(input())
for _ in range(t):
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	cur = 0
	v1 = a
	v2 = b
	c = 0
	while v1 <= n or v2 <= n:
		m = max(v1, v2)
		if m == v1:
			v2 = v2 + v1
		else:
			v1 = v1 + v2
		c += 1
	print(c - 1)


t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	asig = 0
	aflip = 0
	bsig = 0
	bflip = 0
	if a > b:
		aflip = 0
		asig = 0
		bsig = 1
		bflip = 1
	else:
		bflip = 0
		bsig = 0
		asig = 1
		aflip = 1
	res = 0
	c = 0
	locmax = 0
	while n >= locmax:
		if asig == 1 and bsig == 0:
			a += b
			locmax = a
			c += 1
		if bsig == 1 and asig == 0:
			b += a
			c += 1
			locmax = b
		if a > b:
			aflip = 0
			asig = 0
			bsig = 1
			bflip = 1
		else:
			bflip = 0
			bsig = 0
			asig = 1
			aflip = 1
	print(c)
	t -= 1


def solve(a, b):
	turns = 0
	while a <= n and b <= n:
		if a < b:
			a += b
			turns += 1
		else:
			b += a
			turns += 1
	return turns
testcases = int(input())
for i in range(testcases):
	(a, b, n) = map(int, input().split())
	print(solve(a, b))


for _ in range(int(input())):
	cnt = 0
	(a, b, n) = map(int, input().split())
	s = a + b
	b = min(a, b)
	a = s - b
	while b <= n:
		temp = a
		b += a
		a = b
		b = temp
		cnt += 1
	print(cnt - 1)


t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	sum = 0
	ans = 0
	while sum <= n:
		if a > b:
			b += a
			sum = b
			ans += 1
		else:
			a += b
			sum = a
			ans += 1
		if sum > n:
			break
	t = t - 1
	print(ans)


n = int(input())
l = []
while n:
	c1 = 0
	(x, y, z) = map(int, input().split())
	while True:
		if x > y:
			y += x
		else:
			x += y
		c1 = c1 + 1
		if x > z or y > z:
			l.append(c1)
			break
	n = n - 1
for i in l:
	print(i)


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	r = 0
	if b < a:
		(a, b) = (b, a)
	while a <= n and b <= n:
		a += b
		r += 1
		if a > n:
			break
		b += a
		r += 1
	print(r)


def main():
	(a, b, n) = map(int, input().split())
	operations = 0
	while a <= n and b <= n:
		c = max(a, b)
		a = a + b
		b = c
		operations += 1
	print(operations)
t = int(input())
for i in range(t):
	main()


t = int(input())
while t:
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	n = max(a, b)
	count = 0
	while n <= c:
		if a < b:
			a += b
			count += 1
		else:
			b += a
			count += 1
		n = max(a, b)
	print(count)
	t = t - 1


t = int(input())
results = []
for case in range(t):
	(a, b, n) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	count = 0
	while a <= n and b <= n:
		b += a
		temp = a
		a = b
		b = temp
		count += 1
	results.append(count)
for result in results:
	print(result)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	count = 0
	while y <= n:
		temp = x
		x = y
		y = temp + x
		count += 1
	print(count)


for _ in range(int(input())):
	(a, b, n) = [int(_) for _ in input().split()]
	ab = [max(a, b), min(a, b)]
	krok = ktory = 0
	while min(ab) <= n:
		ab[0 if ktory else 1] += ab[1 if ktory else 0]
		ktory = 0 if ktory else 1
		krok += 1
	print(krok - 1)


import sys
import math
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
for t in range(int(input())):
	(a, b, n) = intInp()
	count = 0
	while n >= a and n >= b:
		if a > b:
			b += a
		else:
			a += b
		count += 1
	print(count)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	(j, num) = (1, a + b)
	prox = max(a, b)
	while True:
		if num > n:
			break
		else:
			(temp, num) = (num, num + prox)
			prox = temp
			j = j + 1
	print(j)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(c, d) = (a, b)
	test1 = 0
	flag = 0
	while max(a, b) <= n:
		if flag == 0:
			a += b
			flag = 1
		else:
			b += a
			flag = 0
		test1 += 1
	test2 = 0
	flag = 0
	while max(c, d) <= n:
		if flag == 0:
			d += c
			flag = 1
		else:
			c += d
			flag = 0
		test2 += 1
	print(min(test1, test2))


t = int(input())
while t:
	t = t - 1
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	count = 0
	while a <= n and b <= n:
		if a >= b:
			b += a
			count += 1
			if b > n:
				break
		if b >= a:
			a += b
			count += 1
			if a > n:
				break
	print(count)


for z in range(int(input())):
	(a, b, n) = map(int, input().split())
	ans = 0
	(a, b) = (min(a, b), max(a, b))
	while a <= n and b <= n:
		if ans % 2 == 0:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


t = int(input())
while t > 0:
	(a, b, n) = input().split()
	(a, b, n) = (int(a), int(b), int(n))
	count = 0
	if a > b:
		(b, a) = (a, b)
	count1 = 0
	while a <= n or b <= n:
		if count1 % 2 == 0:
			a += b
			count += 1
		else:
			b += a
			count += 1
		count1 += 1
	print(count - 1)
	t -= 1


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	m = max(a, b)
	b = min(a, b)
	i = 1
	cnt = 0
	while m <= n and b <= n:
		if i % 2 != 0:
			b = b + m
		else:
			m = m + b
		i = i + 1
		cnt = cnt + 1
	print(cnt)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	max1 = max(a, b)
	min1 = min(a, b)
	while min1 <= n:
		min1 += max1
		c += 1
		(min1, max1) = (min(min1, max1), max(min1, max1))
	print(c - 1)


try:
	for _ in range(int(input())):
		(a, b, n) = [int(i) for i in input().split()]
		ans = 0
		while a <= n and b <= n:
			if a < b:
				a += b
			else:
				b += a
			ans += 1
		print(ans)
except:
	pass


import math
for _ in range(int(input())):
	m = 0
	i = 0
	(a, b, n) = map(int, input().split())
	while m <= n:
		t1 = max(a, b)
		t2 = min(a, b)
		m = t1 + t2
		i += 1
		a = m
		b = t1
	print(i)


for _ in range(int(input())):
	x = input().split(' ')
	a = int(x[0])
	b = int(x[1])
	n = int(x[2])
	if max(a, b) > n:
		print(0)
		continue
	count = 0
	while max(a, b) <= n:
		if a > b:
			b = b + a
		else:
			a = a + b
		count = count + 1
	print(count)


import sys
input = sys.stdin.readline
from math import ceil, floor, factorial

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(10000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(a, b, n) = int_array()
	ans = 0
	while a <= n and b <= n:
		(a, b) = sorted([a, b])
		a += b
		ans += 1
	print(ans)


t = int(input())
for ii in range(t):
	(a, b, n) = map(int, input().split())
	count = 0
	c = max(a, b)
	d = min(a, b)
	while c <= n:
		d += c
		(c, d) = (d, c)
		count += 1
	print(count)


n = int(input())
entradas = []
saida = []
for i in range(n):
	entradas.append(input())
for j in entradas:
	entrada = j.split()
	s = 0
	a = int(entrada[0])
	b = int(entrada[1])
	n = int(entrada[2])
	while a <= n and b <= n:
		if a < b:
			a += b
			s += 1
		if a > n:
			break
		b += a
		s += 1
	saida.append(s)
for k in saida:
	print(k)


def run():
	import sys
	sys.stdin = open('/home/puneet/Documents/Cpp Programs/input.txt', 'r')
	sys.stdout = open('/home/puneet/Documents/Cpp Programs/output.txt', 'w')
	from math import ceil, sqrt, floor
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	count = 0
	if a > b:
		x = False
	else:
		x = True
	while a <= n and b <= n:
		if x and a <= n:
			a += b
			x = False
			count += 1
		elif x == False and b <= n:
			b += a
			x = True
			count += 1
		else:
			break
		if a > n:
			break
		if b > n:
			break
	print(count)


import sys
pin = sys.stdin.readline
pout = sys.stdout.write
ran = range
mape = map
maxi = max
t = int(pin())
for i in ran(t):
	(x, y, z) = mape(int, pin().split())
	total = 0
	while maxi(x, y) <= z:
		if x > y:
			y = y + x
		else:
			x = x + y
		total = total + 1
	print(total)


for i1 in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	if a > n or b > n:
		print(0)
		continue
	track = 0
	c = 0
	while c <= n:
		c = a + b
		a = b
		b = c
		track += 1
	print(track)


T = int(input())
while T:
	T -= 1
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	ans = 0
	while a <= n or b <= n:
		a += b
		ans += 1
		if a > n:
			break
		b += a
		ans += 1
		if b > n:
			break
	print(ans)


t = int(input())
while t > 0:
	(a, b, n) = list(map(int, input().split()))
	num_o = 0
	while a <= n and b <= n:
		if a > b:
			b += a
			num_o += 1
		elif a < b:
			a += b
			num_o += 1
		else:
			a += b
			num_o += 1
	print(num_o)
	t -= 1


from math import ceil

def help():
	(a, b, n) = map(int, input().split(' '))
	ans = 0
	while True:
		if max(a, b) > n:
			print(ans)
			return
		(a, b) = (a + b, max(a, b))
		ans += 1
for _ in range(int(input())):
	help()


import sys
input = sys.stdin.readline
for f in range(int(input())):
	(a, b, n) = map(int, input().split())
	i = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		i += 1
	print(i)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	ops = 0
	while True:
		if a > n or b > n:
			break
		bigger = max(a, b)
		if bigger == a:
			b += a
		else:
			a += b
		ops += 1
	print(ops)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for t in range(int(input())):
	(a, b, n) = map(int, input().split())
	ct = 0
	if a < b:
		(a, b) = (b, a)
	while a <= n:
		if a + b > n:
			ct += 1
			a += b
		else:
			b += a
			a += b
			ct += 2
	print(ct)


def ques1(a, b, n):
	count = 0
	x = min(a, b)
	y = max(a, b)
	while y <= n:
		count += 1
		if x == a:
			a += b
			x = min(a, b)
			y = max(a, b)
		else:
			b += a
			x = min(a, b)
			y = max(a, b)
	print(count)
t = int(input())
for i in range(t):
	(a, b, n) = [int(i) for i in input().split()]
	ans = ques1(a, b, n)
	ans


testcases = int(input())
for i in range(testcases):
	(a, b, n) = map(int, input().strip().split(' '))
	count = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		count += 1
	print(count)


from math import ceil
for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	ans = 0
	mx = max(a, b)
	mn = min(a, b)
	while mx <= n and mn <= n:
		if mx > mn:
			mn += mx
		else:
			mx += mn
		ans += 1
	print(ans)


import math
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	x = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		x += 1
	print(x)


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
for _ in range(inp()):
	(a, b, n) = invr()
	c = 0
	while max(a, b) <= n:
		if a >= b:
			b += a
			c += 1
		else:
			a += b
			c += 1
	print(c)


T = int(input())
for i in range(T):
	(a, b, n) = map(int, input().split(' '))
	cnt = 0
	sum_c = a + b
	if a > n or b > n:
		print(0)
	else:
		while sum_c <= n:
			if a >= b:
				b = sum_c
			else:
				a = sum_c
			sum_c = a + b
			cnt = cnt + 1
		print(cnt + 1)


import sys
from copy import copy
input = sys.stdin.readline

def solve(a, b, n):
	if a > n or b > n:
		return 0
	if a > b:
		(a, b) = (b, a)
	return 1 + solve(a + b, b, n)
for _ in range(int(input())):
	(a, b, n) = [int(a) for a in input().split()]
	print(solve(a, b, n))


def val(a, b):
	return [a + b, b]
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	count = 0
	if a > b:
		temp = b
		b = a
		a = temp
	while a <= n and b <= n:
		[b, a] = val(a, b)
		count += 1
	print(count)


test = int(input())
for i in range(test):
	(a, b, n) = [int(i) for i in input().split()]
	ans = 0
	while a <= n and b <= n:
		if a >= b:
			b += a
		else:
			a += b
		ans += 1
	print(ans)


t = int(input())
r = []

def init(a):
	for l in range(len(a)):
		a[l] = int(a[l])
	return a

def summa(x, y):
	if x > y:
		y = x + y
	else:
		x = x + y
for q in range(t):
	v = []
	cnt = 1
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	v = [a, b]
	if a > b:
		b = a + b
	else:
		a = a + b
	while max(a, b) <= n:
		if a > b:
			b = a + b
		else:
			a = a + b
		cnt = cnt + 1
	print(cnt)


import sys
cont = sys.stdin.readlines()
cont = [i.strip('\n').split() for i in cont]
numTests = int(cont.pop(0)[0])
for i in cont:
	(a, b, n) = i
	(a, b, n) = (int(a), int(b), int(n))
	count = 0
	while a + b <= n:
		(a, b) = (min(a, b) + max(a, b), max(a, b))
		count += 1
	print(count + 1)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	curr = max(a, b)
	last = a + b - curr
	cnt = 0
	while curr <= n:
		(curr, last) = (curr + last, curr)
		cnt += 1
	print(cnt)


t = int(input())
while t > 0:
	t -= 1
	s = str(input())
	l = s.split()
	a = int(l[0])
	b = int(l[1])
	n = int(l[2])
	ans = -1
	while n >= a or n >= b:
		z = max(a, b)
		if z != a:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


from collections import Counter
from collections import defaultdict
from collections import deque
import math
import heapq
import sys
import io, os
input = sys.stdin.readline
from bisect import *
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().strip().split()))
rls = lambda : list(map(str, input().split()))
t = int(input())
for _ in range(0, t):
	(a, b, n) = rl()
	if a < b:
		(a, b) = (b, a)
	c = 0
	while 1:
		if c % 2 == 0:
			b = b + a
		else:
			a += b
		c = c + 1
		if a > n or b > n:
			print(c)
			break


t = int(input())
for _ in range(t):
	(a, b, n) = [int(x) for x in input().split()]
	c = 0
	while True:
		c += 1
		if a + b > n:
			break
		if a > b:
			b += a
		else:
			a += b
	print(c)


import sys

def solve():
	T = int(input())
	for tests in range(0, T):
		(a, b, n) = map(int, input().split())
		ans = 0
		while a <= n and b <= n:
			if a < b:
				a += b
			else:
				b += a
			ans += 1
		print(ans)

def main():
	solve()
main()


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(a, b, n) = list(map(int, input().split()))
	c = 0
	while max(a, b) <= n:
		(a, b) = (min(a, b), max(a, b))
		a = a + b
		c += 1
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a > n or b > n:
		print(0)
		continue
	c = 0
	while a <= n and b <= n:
		p = max(a, b)
		q = min(a, b)
		q += p
		a = p
		b = q
		c += 1
	print(c)


t = int(input())
p = []
for i in range(t):
	l = list(map(int, input().split()))
	p.append(l)

def leo(a, b, n):
	if a > n or b > n:
		return 0
	else:
		c = min(a, b)
		d = max(a, b)
		return 1 + leo(c + d, d, n)
for i in range(t):
	e = leo(p[i][0], p[i][1], p[i][2])
	print(e)


t = int(input())
for i in range(t):
	s = input()
	(a, b, n) = s.split()
	a = int(a)
	b = int(b)
	n = int(n)
	if a < b:
		(a, b) = (b, a)
	co = 0
	c = 0
	while c <= n:
		c = b + a
		b = a
		a = c
		co = co + 1
	print(co)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	y = 0
	if a > b:
		while a <= n and b <= n:
			if y % 2 == 0:
				b += a
				y += 1
			else:
				a += b
				y += 1
	else:
		while a <= n and b <= n:
			if y % 2 == 0:
				a += b
				y += 1
			else:
				b += a
				y += 1
	print(y)


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = int(input())
for t in range(test_count):
	(a, b, n) = invr()
	if a > b:
		(a, b) = (b, a)
	if a + b > n:
		print(1)
	else:
		max_f = n // (a + b)
		f = list()
		x1 = 1
		x2 = 1
		f.append(x1)
		f.append(x2)
		while x2 <= max_f:
			f.append(x1 + x2)
			(x1, x2) = (x2, x1 + x2)
		ans = len(f)
		for i in range(len(f) - 1, -1, -1):
			if f[i] * b + f[i - 1] * a <= n:
				break
			ans = i
		print(ans)


from sys import stdin
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	ops = 0
	while max(a, b) <= n:
		(a, b) = (max(a, b), a + b)
		ops += 1
	print(ops)


import sys
input = sys.stdin.readline
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda : int(input())
ip = lambda : [int(w) for w in input().split()]
for _ in range(inp()):
	(a, b, n) = ip()
	i = 0
	x = [a, b]
	x.sort()
	while True:
		i += 1
		no = x[-1] + x[-2]
		if no > n:
			break
		x.append(no)
	print(i)


T = int(input())
for i in range(T):
	(a, b, n) = map(int, input().split())
	s = 0
	count = 0
	while a <= n and b <= n:
		w = min(a, b)
		if w == a:
			a += b
			count += 1
		else:
			b += a
			count += 1
	print(count)


def steps(a, b, target):
	steps = 0
	while a <= target or b <= target:
		if target - a < b or target - b < a:
			return steps + 1
		if a > b:
			b += a
		else:
			a += b
		steps += 1
	return steps
for _ in range(int(input())):
	(a, b, target) = [int(u) for u in input().split()]
	print(steps(a, b, target))


import math
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	fib = [1] * 100
	for i in range(2, 100):
		fib[i] = fib[i - 1] + fib[i - 2]
	for i in range(100):
		if fib[i] * a + fib[i + 1] * b > n:
			print(i + 1)
			break


t = int(input())
c = []
for i in range(t):
	(a, b, n) = input().split()
	(a, b, n) = (int(a), int(b), int(n))
	count = 0
	while True:
		if a < b:
			a = a + b
		else:
			b = a + b
		count += 1
		if max(a, b) > n:
			break
	c.append(count)
for j in c:
	print(j)


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split(' ')))
	count = 0
	while a <= n or b <= n:
		if a <= b:
			a = a + b
		elif a > b:
			b = b + a
		count = count + 1
	print(count - 1)


def gns():
	return list(map(int, input().split()))
t = int(input())
for i in range(t):
	(a, b, n) = gns()
	ans = 0
	while max(a, b) <= n:
		ans += 1
		if a < b:
			a += b
		else:
			b += a
	print(ans)


t = int(input())
while t > 0:
	(a, b, n) = input().split()
	(a, b, n) = (int(a), int(b), int(n))
	num = 0
	while a <= n:
		if a > b:
			(a, b) = (b, a)
		a += b
		num += 1
	print(num)
	t -= 1


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a > n or b > n:
		print(0)
	else:
		l = []
		l.append(min(a, b))
		l.append(max(a, b))
		ans = 1
		t = a + b
		while t <= n:
			l.append(t)
			a = l[-2]
			b = l[-1]
			t = a + b
			ans += 1
		print(ans)


import sys
import math
import operator as op
from functools import reduce
from bisect import *
from collections import OrderedDict
from collections import deque

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def read_float_line():
	return [float(v) for v in sys.stdin.readline().split()]

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer / denom

def index(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return -1

def find_lt(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	return -1

def find_le(a, x):
	i = bisect_right(a, x)
	if i:
		return i - 1
	return -1

def find_gt(a, x):
	i = bisect_right(a, x)
	if i != len(a):
		return i
	return -1

def find_ge(a, x):
	i = bisect_left(a, x)
	if i != len(a):
		return i
	return -1
mod = int(1000000000.0) + 7
mod2 = 998244353
t = read_int()
for i in range(t):
	(a, b, n) = read_int_line()
	a1 = a
	b1 = b
	cnt = 0
	f = 1
	while a <= n and b <= n:
		if f == 1:
			b += a
			f *= -1
		else:
			a += b
			f *= -1
		cnt += 1
	cnt1 = 0
	f1 = 1
	while a1 <= n and b1 <= n:
		if f1 == -1:
			b1 += a1
			f1 *= -1
		else:
			a1 += b1
			f1 *= -1
		cnt1 += 1
	print(min(cnt, cnt1))


def ans(a, b, n):
	count = 0
	while a <= n and b <= n:
		if b > a:
			a += b
			count += 1
		else:
			b += a
			count += 1
	return count
x = int(input())
L = []
for i in range(x):
	(a, b, n) = map(int, input().split())
	L.append(ans(a, b, n))
for l in L:
	print(l)


t = int(input(''))
while t > 0:
	(a, b, n) = map(int, input().split())
	if a > n or b > n:
		ans = 0
		x = n + 1
	ans = 0
	t1 = min(a, b)
	t2 = max(a, b)
	x = b
	while x <= n:
		ans += 1
		x = t2 + t1
		t1 = t2
		t2 = x
	print(ans)
	t -= 1


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	count = 0
	(x, y) = (0, 0)
	s = 0
	if b > a:
		y += b
		x += a
	else:
		y += a
		x += b
	while y <= n:
		s = max(s, y)
		y += x
		x = max(x, s)
		count += 1
	print(count)


def solve(a, b, n):
	big = float('inf')
	small = float('-inf')
	steps = 0
	while max(a, b) < n:
		if a + b > n:
			return steps + 1
		if a <= b:
			a += b
		else:
			b += a
		steps += 1
	return steps + 1

def main():
	t = int(input())
	for i in range(t):
		d = input()
		d = [int(i) for i in d.split()]
		a = d[0]
		b = d[1]
		c = d[2]
		ans = solve(a, b, c)
		print(ans)
main()


from sys import stdin, exit, setrecursionlimit
from math import *
from collections import deque
setrecursionlimit(10000000)
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for _ in range(int(input())):
	(a, b, n) = mi()
	(oa, ob) = (a, b)
	cnt1 = 0
	while a <= n and b <= n:
		cnt1 += 1
		if a > b:
			b += a
		else:
			a += b
	cnt2 = 0
	a = ob
	b = oa
	while a <= n and b <= n:
		cnt2 += 1
		if a > b:
			b += a
		else:
			a += b
	print(min(cnt1, cnt2))


from sys import stdout
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	k = 0
	while True:
		a += b
		k += 1
		if a > n:
			print(k)
			break
		b += a
		k += 1
		if b > n:
			print(k)
			break


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	l = [a, b]
	i = 0
	sum = max(a, b)
	while sum <= n:
		p = max(l)
		l.remove(max(l))
		sum += max(l)
		l.append(sum)
		l.append(p)
		i += 1
	print(i)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	ans = 0
	final = 0
	if a > b:
		ans = 1
	else:
		ans = 0
	while a <= n and b <= n:
		if ans % 2 == 0:
			a += b
			ans += 1
			final += 1
		else:
			b += a
			ans += 1
			final += 1
	print(final)


for x in range(int(input())):
	(a, b, n) = map(int, input().split())
	cnt = 0
	(a, b) = (max(a, b), min(a, b))
	while a <= n and b <= n:
		if not cnt % 2:
			b += a
		else:
			a += b
		cnt += 1
	print(cnt)


N = int(input())
for i in range(N):
	(a, b, c) = [int(x) for x in input().split()]
	counter1 = 0
	counter2 = 0
	(x, y, z) = [a, b, c]
	while a <= c or b <= c:
		a += b
		counter1 += 1
		if a > c:
			break
		b += a
		counter1 += 1
		if b > c:
			break
	while x <= z or y <= z:
		y += x
		counter2 += 1
		if y > z:
			break
		x += y
		counter2 += 1
		if x > z:
			break
	if counter1 > counter2:
		print(counter2)
	else:
		print(counter1)


for i in range(int(input())):
	l = list(map(int, input().split()))
	x = max(l[0], l[1])
	y = min(l[0], l[1])
	s = 0
	while max(x, y) <= l[2]:
		z = x + y
		t = x
		x = z
		y = t
		s = s + 1
	print(s)


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	t = 0
	while a <= n and b <= n:
		(a, b) = (max(a, b), min(a, b))
		b += a
		t += 1
	print(t)


while True:
	try:
		T = eval(input())
		for i in range(T):
			(a, b, n) = map(int, input().split())
			cnt = 0
			while a <= n and b <= n:
				if a < b:
					a += b
				else:
					b += a
				cnt += 1
			print(cnt)
	except:
		break


def solver(a, b, n):
	if a > b:
		(a, b) = (b, a)
	result = 0
	while max(a, b) <= n:
		result += 1
		a += b
		(a, b) = (b, a)
	return result
for _ in range(int(input())):
	(A, B, N) = [int(i) for i in input().split()]
	print(solver(A, B, N))


def solve(a, b, n):
	if a > n or b > n:
		return 0
	else:
		return 1 + solve(max(a, b), a + b, n)
t = int(input())
queries = []
for i in range(1, t + 1):
	queries.append(input().split())
for query in queries:
	num_operations = solve(int(query[0]), int(query[1]), int(query[2]))
	print(num_operations)


rows = int(input())
for i in range(rows):
	nums = input().split()
	a = int(nums[0])
	b = int(nums[1])
	n = int(nums[2])
	times = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		times += 1
	print(times)


def cal(a, b, n):
	s = 0
	while 1:
		b = a + b
		s += 1
		if b > n:
			break
		a = a + b
		s += 1
		if a > n:
			break
	return s
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	if a > b:
		print(cal(a, b, n))
	else:
		print(cal(b, a, n))


import math
import sys
input = sys.stdin.readline
t = int(input())
result = []
for cs in range(t):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while max(a, b) <= n:
		if a > b:
			(a, b) = (b, a)
		a += b
		cnt = cnt + 1
	result.append(cnt)
print('\n'.join(map(str, result)))


n_consultas = int(input())
for i in range(n_consultas):
	(a, b, n) = input().split(' ')
	(a, b, n) = (int(a), int(b), int(n))
	count = 1
	soma = a + b
	while soma <= n:
		if a >= b:
			b += a
			count += 1
			soma = a + b
		elif b > a:
			a += b
			count += 1
			soma = a + b
	print(count)


a = int(input())
i = 0
while i < a:
	k = 0
	b = input().split(' ')
	c = int(b[0])
	d = int(b[1])
	e = int(b[2])
	k = k + 1
	if c + d > e:
		print(k)
	else:
		while c + d <= e:
			k = k + 1
			if c >= d:
				d = c + d
			else:
				c = c + d
		print(k)
	i = i + 1


list1 = []
list1.append(0)
list1.append(1)
list1.append(1)

def task():
	global list1
	a = 1
	b = 1
	for _ in range(50):
		temp = a + b
		list1.append(temp)
		a = b
		b = temp
task()
t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().strip().split()))
	for i in range(len(list1) - 1):
		if list1[i] * a + list1[i + 1] * b > n or list1[i] * b + list1[i + 1] * a > n:
			print(i)
			break


import math

def solution():
	(a, b, n) = list(map(int, input().split()))
	v1 = min(a, b)
	v2 = max(a, b)
	count = 0
	while v1 <= n and v2 <= n:
		if count % 2 == 0:
			v1 += v2
		else:
			v2 += v1
		count += 1
	print(count)
T = int(input())
while T:
	solution()
	T -= 1


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	steps = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		steps += 1
	print(steps)


def c():
	T = int(input())
	for k in range(T):
		(a, b, n) = list(map(int, input().split(' ')))
		ans = 0
		while max(a, b) <= n:
			if a <= b:
				a += b
			else:
				b += a
			ans += 1
		print(ans)
c()


def logic(a, b, n, count):
	if max(a, b, n) != n:
		return count
	if a > b:
		return logic(a, a + b, n, count + 1)
	else:
		return logic(a + b, b, n, count + 1)
cases = int(input())
for i in range(cases):
	(a, b, n) = map(int, input().split())
	print(logic(a, b, n, 0))


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	ctr = 0
	sum = 0
	temp = 0
	f = True
	if b > a:
		temp = a
		a = b
		b = temp
	while a <= n and b <= n:
		if f:
			b = b + a
			f = False
		else:
			a = a + b
			f = True
		ctr = ctr + 1
	print(ctr)


import sys

def input():
	return sys.stdin.readline().rstrip()

def input_split():
	return [int(i) for i in input().split()]
testCases = int(input())
answers = []
fibo = [0, 1, 1]
for i in range(100):
	fibo.append(fibo[-1] + fibo[-2])
for _ in range(testCases):
	(a, b, n) = input_split()
	(a, b) = (min(a, b), max(a, b))
	for i in range(100):
		x = fibo[i] * a + fibo[i + 1] * b
		if x > n:
			ans = i
			break
	answers.append(ans)
print(*answers, sep='\n')


for w in range(int(input())):
	(a, b, n) = (int(x) for x in input().split())
	u = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		u += 1
	print(u)


T = int(input())
for _ in range(T):
	(a, b, n) = list(map(int, input().split()))
	s = max(a, b)
	step = 0
	while s <= n:
		s = a + b
		a = max(a, b)
		b = s
		step += 1
	print(step)


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	if b > a:
		(a, b) = (b, a)
	apeb = False
	cnt = 0
	if a > n or b > n:
		print(cnt)
		continue
	while a <= n or b <= n:
		if apeb:
			a += b
		else:
			b += a
		cnt += 1
		apeb = not apeb
	print(cnt - 1)


import sys
input = sys.stdin.readline
getS = lambda : input().strip()
getN = lambda : int(input())
getList = lambda : list(map(int, input().split()))
getZList = lambda : [int(x) - 1 for x in input().split()]
INF = 10 ** 20
MOD = 1000000007

def solve():
	(a, b, n) = getList()
	if a > b:
		(a, b) = (b, a)
	ans = 0
	while True:
		a += b
		ans += 1
		if a > n:
			print(ans)
			return
		(a, b) = (b, a)

def main():
	n = getN()
	for _ in range(n):
		solve()
main()


for i in range(int(input())):
	(a, b, n) = [int(k) for k in input().split()]
	flag = 0
	if a >= b:
		max = a
		min = b
	else:
		max = b
		min = a
	while max <= n:
		(max, min) = (max + min, max)
		flag += 1
	print(flag)


d = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049, 12586269025, 20365011074, 32951280099, 53316291173, 86267571272, 139583862445, 225851433717, 365435296162, 591286729879, 956722026041, 1548008755920, 2504730781961, 4052739537881, 6557470319842, 10610209857723, 17167680177565, 27777890035288, 44945570212853, 72723460248141, 117669030460994, 190392490709135, 308061521170129, 498454011879264, 806515533049393, 1304969544928657, 2111485077978050, 3416454622906707, 5527939700884757, 8944394323791464, 14472334024676221, 23416728348467685, 37889062373143906, 61305790721611591, 99194853094755497, 160500643816367088, 259695496911122585, 420196140727489673, 679891637638612258, 1100087778366101931, 1779979416004714189, 2880067194370816120, 4660046610375530309, 7540113804746346429, 12200160415121876738, 19740274219868223167, 31940434634990099905, 51680708854858323072, 83621143489848422977, 135301852344706746049, 218922995834555169026]
t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	small = min(a, b)
	big = max(a, b)
	for j in range(1, len(d) - 1):
		if big * d[j + 1] + small * d[j] > n:
			print(j)
			break


def func(n):
	for i in range(n):
		k = list(map(int, input().split()))
		a = k[0]
		b = k[1]
		n = k[2]
		counter = 0
		while a <= n and b <= n:
			if a > b:
				b += a
				counter += 1
			else:
				a += b
				counter += 1
		print(counter)
n = int(input())
func(n)


def check(a, b, k, c):
	if a + b > k:
		return c + 1
	else:
		(a, b) = (min(a, b), max(a, b))
		return check(a + b, b, k, c + 1)
for _ in range(int(input())):
	(a, b, k) = list(map(int, input().split()))
	print(check(a, b, k, 0))


t = int(input())
while t:
	t -= 1
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	(c, i) = (0, 0)
	while c <= n:
		c = a + b
		a = b
		b = c
		i += 1
	print(i)


from math import *
import sys, random

def nextInt():
	return int(input())

def nextStrs():
	return input().split()

def nextInts():
	return list(map(int, nextStrs()))

def main():
	t = nextInt()
	while t > 0:
		(a, b, n) = nextInts()
		res = 0
		while a <= n and b <= n:
			if a > b:
				b += a
			else:
				a += b
			res += 1
		print(res)
		t -= 1
exit(main())


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	count = 0
	ma = max(a, b)
	mi = min(a, b)
	sw = 1
	while max(ma, mi) <= n:
		if sw == 0:
			ma = mi + ma
			sw = 1
		else:
			mi = mi + ma
			sw = 0
		count = count + 1
	print(count)


import sys
input = sys.stdin.readline

def solve():
	(a, b, n) = [int(x) for x in input().split()]
	arr = sorted([a, b])
	while arr[-1] <= n:
		arr.append(arr[-1] + arr[-2])
	print(len(arr) - 2)
tt = int(input())
for test in range(tt):
	solve()


from sys import stdin, stdout
import math
input = stdin.readline

def print(x='', end='\n'):
	stdout.write(str(x) + end)

def solve():
	(a, b, n) = map(int, input().split())
	count = 0
	flag = 0
	(a, b) = (min(a, b), max(a, b))
	while True:
		if a > n or b > n:
			break
		if flag:
			b += a
			flag = 0
		else:
			a += b
			flag = 1
		count += 1
	print(count)
test = 1
test = int(input())
for __ in range(test):
	solve()


T = int(input())
for _ in range(T):
	(a, b, n) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	curr_fib = [1, 1]
	moves = 0
	ans = 0
	while ans < n:
		ans1 = curr_fib[moves] * x + curr_fib[moves + 1] * y
		ans2 = curr_fib[moves] * y + curr_fib[moves + 1] * x
		ans = max(ans1, ans2)
		if ans > n:
			break
		else:
			curr_fib.append(curr_fib[moves] + curr_fib[moves + 1])
			moves += 1
	print(moves + 1)


tt = int(input())
for loop in range(tt):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		cnt += 1
	print(cnt)


from sys import exit, stdin, stderr

def rl():
	return [int(w) for w in stdin.readline().split()]
(T,) = rl()
for _ in range(T):
	(a, b, n) = rl()
	t = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		t += 1
	print(t)


import math

def solve(a, b, n):
	big = max(a, b)
	small = min(a, b)
	ans = small
	op = 0
	while ans <= n:
		op += 1
		ans += big
		if ans > n:
			break
		(ans, big) = (big, ans)
	return op
t = int(input())
for we in range(t):
	(a, b, n) = map(int, input().split())
	print(solve(a, b, n))


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	(a, b, n) = read_ints()
	times = 0
	while a <= n and b <= n:
		times += 1
		if a > b:
			b += a
		else:
			a += b
	print(times)


t = int(input())
for _ in range(t):
	all = [int(i) for i in input().split()]
	n = all[2]
	(a, b) = (all[0], all[1])
	if a > b:
		(a, b) = (b, a)
	(x, y) = (0, 1)
	k = 0
	while a * x + b * y <= n:
		(x, y) = (y, x + y)
		k += 1
	print(k)


s = int(input())
count = 0
ans = []
while count < s:
	t = input()
	t = [int(x) for x in t.split()]
	(a, b, n) = sorted(t)
	ste = 0
	while int(a) <= int(n) and int(b) <= int(n):
		a = int(a) + int(b)
		b = int(a) + int(b)
		ste += 2
	if a > int(n) and b > int(n):
		ste -= 1
	ans.append(ste)
	count += 1
for y in ans:
	print(y)


from fractions import Fraction
import bisect
import os
import io
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
from queue import Queue

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = 1
t = iinput()
for _ in range(t):
	(a, b, n) = rinput()
	ans = 0
	while a <= n and b <= n:
		if a <= b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


FibArray = [0, 1]

def fibonacci(n):
	if n < 0:
		print('Incorrect input')
	elif n <= len(FibArray):
		return FibArray[n - 1]
	else:
		temp_fib = fibonacci(n - 1) + fibonacci(n - 2)
		FibArray.append(temp_fib)
		return temp_fib
t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split(' ')))
	(f1, f2, f3) = [0, 1, 1]
	num_op = 0
	ma = max(a, b)
	mi = min(a, b)
	while f2 * ma + f1 * mi <= n:
		f1 = f2
		f2 = f3
		f3 = f1 + f2
		num_op += 1
	print(num_op)


n = int(input())
for i in range(n):
	nums = [int(m) for m in input().split()]
	a = nums[0]
	b = nums[1]
	c = nums[2]
	ct = 0
	while a <= c and b <= c:
		ct += 1
		if a > b:
			(a, b) = (b, a)
		a += b
	print(ct)


for tc in range(int(input())):
	(a, b, n) = map(int, input().split())
	answer = max(a, b)
	count = 0
	while answer <= n:
		if a > b:
			b += a
			answer = b
		else:
			a += b
			answer = a
		count += 1
	print(count)


def no_of_ways(a, b, n):
	count = 0
	while a <= n and b <= n:
		if a < b:
			a += b
			count += 1
		else:
			b += a
			count += 1
	return count
t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	print(no_of_ways(a, b, n))


import math as mt
import sys, string
input = sys.stdin.readline
from collections import defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
for _ in range(t):
	(a, b, n) = M()
	c = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		c += 1
	print(c)


import sys, math, itertools, collections, copy
input = sys.stdin.readline

def solve():
	(a, b, n) = map(int, input().split())
	dp = [0] * 10 ** 3
	(dp[0], dp[1]) = (min(a, b), max(a, b))
	ans = 0
	for i in range(2, 1000):
		dp[i] = dp[i - 1] + dp[i - 2]
		ans += 1
		if dp[i] > n:
			break
	print(ans)
for _ in range(int(input())):
	solve()


t = int(input())
count = 0
while count < t:
	count += 1
	(a, b, n) = map(int, input().split(' '))
	A = max(a, b)
	B = min(a, b)
	nums = [0, 1]
	ans = 0
	while nums[-1] * A + nums[-2] * B <= n:
		ans += 1
		nums.append(nums[-1] + nums[-2])
	print(ans)


for _ in range(int(input())):
	(a, b, n) = [int(i) for i in input().split()]
	min1 = min([a, b])
	max1 = max([a, b])
	nd = 0
	i = 0
	while min1 <= n and max1 <= n:
		if i % 2 == 0:
			min1 = min1 + max1
			nd += 1
		else:
			max1 = max1 + min1
			nd += 1
		i += 1
	print(nd)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = a
	a = min(a, b)
	b = max(c, b)
	a += b
	i = 1
	while a <= n and b <= n:
		i += 1
		a += b * (i % 2 == 1)
		b += a * (i % 2 == 0)
	print(i)


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	(a, b) = sorted([a, b])
	i = 0
	while a <= n and b <= n:
		if i % 2 == 0:
			a += b
		else:
			b += a
		i += 1
	print(i)


t = int(input())
import math
for _ in range(t):
	(a, b, n) = map(int, input().split())
	c = min(a, b)
	d = max(a, b)
	if d > n:
		print(d)
	else:
		lad = d
		s = c
		i = 0
		while max(c, d) <= n:
			i += 1
			x = min(c, d)
			y = max(c, d)
			x += y
			c = x
			d = y
		print(i)


from math import gcd as gc, ceil as cl, floor as fl
from bisect import bisect as bi, bisect_left as bl, bisect_right as br
fibo = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903]

def GCD(A):
	ret = A[0]
	for i in A:
		ret = gc(ret, i)
	return ret

def solve():
	(a, b, n) = list(map(int, input().split()))
	if max(a, b) > n:
		print(0)
		return
	if a == max(a, b):
		i = 1
		for i in range(1, 46):
			if fibo[i] * a + fibo[i - 1] * b > n:
				print(i)
				return
	else:
		i = 1
		for i in range(1, 46):
			if fibo[i - 1] * a + fibo[i] * b > n:
				print(i)
				return
for _ in range(int(input())):
	solve()


def read_int():
	return int(input())

def read_string_array():
	for s in input().split():
		yield s

def read_int_array():
	for s in read_string_array():
		yield int(s)

def read_line():
	return input()

def solve(a, b, n):
	steps = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		steps += 1
	return steps
T = read_int()
for _ in range(T):
	(A, B, N) = read_int_array()
	print(solve(A, B, N))


import sys
input = sys.stdin.readline
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]
for (a, b, n) in Query:
	if a < b:
		(a, b) = (b, a)
	ans = 0
	while a <= n:
		(a, b) = (b + a, a)
		ans += 1
	print(ans)


t = int(input())
fib = []
fib.append(0)
fib.append(1)
pos = 2
while fib[pos - 1] + fib[pos - 2] <= 1000000001:
	fib.append(fib[pos - 1] + fib[pos - 2])
	pos += 1
for i in range(t):
	(a, b, n) = map(int, input().split())
	if b < a:
		a ^= b
		b ^= a
		a ^= b
	for j in range(1, pos):
		if fib[j - 1] * a + fib[j] * b > n:
			print(j - 1)
			break


num_tests = int(input())
tests_results = []
for test in range(num_tests):
	(a, b, n) = list(map(int, input().split()))
	repetitions = 0
	while n >= a and n >= b:
		if a >= b:
			b += a
		else:
			a += b
		repetitions += 1
	tests_results.append(repetitions)
for test in tests_results:
	print(test)


from sys import stdin, stdout
import sys
from math import *
for __ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	ans = 0
	t = 0
	while a <= n and b <= n:
		if t == 0:
			a += b
			t = 1
			ans += 1
		else:
			b += a
			t = 0
			ans += 1
	print(ans)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def solve(a, b, n):
	ans = 0
	while a <= n and b <= n:
		if a >= b:
			b += a
		else:
			a += b
		ans += 1
	return ans

def main():
	t = int(input())
	for _ in range(t):
		(a, b, n) = map(int, input().split())
		ans = solve(a, b, n)
		sys.stdout.write(str(ans) + '\n')
main()


from copy import *
from math import *
t = int(input())
for i in range(t):
	(a, b, n) = list(map(int, input().split()))
	m = min(a, b)
	m1 = max(a, b)
	l = [m, m1]
	if m1 > n:
		print(0)
		continue
	c = 0
	while True:
		l.append(l[-1] + l[-2])
		c += 1
		if l[-1] > n:
			break
	print(c)


import math
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	a1 = a
	b1 = b
	if max(a, b) > n:
		print(0)
	ct = 0
	while True:
		if a > n or b > n:
			break
		if b <= a:
			b += a
		else:
			a += b
		ct += 1
	b = a1
	a = b1
	ct1 = 0
	while True:
		if a > n or b > n:
			break
		if b <= a:
			b += a
		else:
			a += b
		ct1 += 1
	print(min(ct, ct1))


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	t1 = max(a, b)
	t2 = min(a, b)
	c1 = 0
	s1 = 0
	while s1 <= n:
		s1 = t2 + t1
		if s1 > n:
			break
		t2 = t1
		t1 = s1
		c1 += 1
	print(c1 + 1)


t = int(input())
for _ in range(t):
	(n1, n2, max) = map(int, input().split())
	count = 0
	while n1 <= max and n2 <= max:
		if n1 > n2:
			(n1, n2) = (n2, n1)
		n1 = n1 + n2
		count += 1
	print(count)


def solve(a, b, n):
	if a < b:
		(a, b) = (b, a)
	f = True
	c = 0
	while a <= n and b <= n:
		if f:
			b += a
			f = False
		else:
			f = True
			a += b
		c += 1
	return c
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	res = solve(a, b, n)
	print(res)


import sys
import math
from collections import *

def get_ints():
	return map(int, input().split())

def get_list():
	return list(get_ints())

def printspx(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0 + 7)
SEXYMOD = 998244353
MAXN = int(100000.0)
for _testcases_ in range(int(input())):
	(a, b, m) = get_ints()
	(a, b) = (max(a, b), min(a, b))
	c = 0
	while a <= m:
		(a, b) = (a + b, a)
		c += 1
	print(c)


n = int(input())

def solve():
	(a, b, n) = map(int, input().split())
	mode = True
	if a >= b:
		mode = True
	else:
		mode = False
	operations = 0
	while b <= n and a <= n:
		if mode:
			b += a
			mode = False
		else:
			a += b
			mode = True
		operations += 1
	print(operations)
for i in range(n):
	solve()


import math
import sys
import itertools

def sa(Type=int):
	return [Type(x) for x in input().split()]

def solve(t):
	(a, b, n) = sa()
	steps = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		steps += 1
	print(steps)
t = int(input())
for i in range(t):
	solve(i + 1)


nb_cases = int(input())
while nb_cases > 0:
	nb_cases -= 1
	(a, b, n) = [int(x) for x in input().split()]
	nb_operation = 0
	while a <= n and b <= n:
		nb_operation += 1
		if a < b:
			a += b
		else:
			b += a
	print(nb_operation)


def increase(a, b, n):
	count = 0
	while a <= n and b <= n:
		if b <= a:
			b = b + a
			count = count + 1
			if b > n:
				return count
		elif b >= a:
			a = a + b
			count = count + 1
			if a > n:
				return count

def main():
	t = int(input())
	r = 0
	while r < t:
		s = input().split()
		(a, b, n) = (int(s[0]), int(s[1]), int(s[2]))
		print(increase(a, b, n))
		r = r + 1
main()


from sys import stdin, stdout
test = int(stdin.readline())
for _ in range(test):
	(a, b, n) = map(int, stdin.readline().split())
	cnt = 0
	while a <= n and b <= n:
		cnt += 1
		if a > b:
			b += a
		else:
			a += b
	print(cnt)


for i in range(int(input())):
	arr = [int(i) for i in list(input().split())]
	(a, b) = (arr[0], arr[1])
	count = 0
	while a <= arr[2] and b <= arr[2]:
		if a >= b:
			b += a
		else:
			a += b
		count += 1
	print(count)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	f = 0
	(a, b) = (max(a, b), min(a, b))
	(c, d) = (b, a)
	c1 = 0
	c2 = 0
	while a <= n and b <= n:
		if f == 0:
			a += b
			f = 1
		else:
			b += a
			f = 0
		c1 += 1
	f = 0
	while c <= n and d <= n:
		if f == 0:
			c += d
			f = 1
		else:
			d += c
			f = 0
		c2 += 1
	print(min(c1, c2))


t = int(input())
for i in range(t):
	a = input().split()
	x = int(a[0])
	y = int(a[1])
	n = int(a[2])
	m = 0
	if x > y:
		while 1:
			y += x
			m += 1
			if y > n:
				break
			x += y
			m += 1
			if x > n:
				break
	else:
		while 1:
			x += y
			m += 1
			if x > n:
				break
			y += x
			m += 1
			if y > n:
				break
	print(m)


t = int(input())
while t > 0:
	(a, b, n) = list(map(int, input().split(' ')))
	t -= 1
	c = 0
	while True:
		if a < b:
			a += b
			c += 1
			if a > n:
				break
			else:
				b += a
				c += 1
				if b > n:
					break
		else:
			b += a
			c += 1
			if b > n:
				break
			else:
				a += b
				c += 1
				if a > n:
					break
	print(c)


ans = []
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	k = 1
	while a + b <= n:
		if a <= b:
			a += b
		elif b < a:
			b += a
		k += 1
	else:
		ans += [k]
print('\n'.join(map(str, ans)))


T = int(input())
while T:
	(X, Y, Z) = map(int, input().split(' '))
	res = 0
	while X <= Z or Y <= Z:
		if X > Z or Y > Z:
			break
		res += 1
		if X < Y:
			X += Y
		else:
			Y += X
	print(res)
	T -= 1


T = int(input().rstrip())
for tt in range(T):
	(a, b, n) = list(map(int, input().rstrip().split(' ')))
	(a, b) = (min(a, b), max(a, b))
	cnt = 0
	while b <= n:
		(a, b) = (b, a + b)
		cnt += 1
	print(cnt)


import sys
input = sys.stdin.readline

def solve():
	(a, b, n) = map(int, input().split())
	maior = max(a, b)
	menor = min(a, b)
	ope = 0
	while maior <= n:
		resultado = maior + menor
		menor = maior
		maior = resultado
		ope += 1
	print(ope)
test = int(input())
while test != 0:
	solve()
	test -= 1


t = int(input())
for i in range(t):
	(a, b, n) = list(map(int, input().split()))
	(c, x) = (0, 0)
	while x <= n:
		x = a + b
		b = max(a, b)
		a = x
		c += 1
	print(c)


import math
import os
import random
import re
import sys
from collections import defaultdict
fib_ara = [1, 1]

def fib():
	while fib_ara[-1] < 10 ** 9:
		fib_ara.append(fib_ara[-1] + fib_ara[-2])
fib()
case = int(input())
for i in range(case):
	a = [int(x) for x in input().split()]
	(a, b, n) = (a[0], a[1], a[2])
	small = min(a, b)
	large = max(a, b)
	for j in range(1, len(fib_ara)):
		if fib_ara[j] * large + fib_ara[j - 1] * small > n:
			print(j)
			break


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	pf1 = 1
	f1 = 1
	f2 = 1
	i = 1
	notFound = True
	while notFound:
		if f1 * min(a, b) + f2 * max(a, b) > n:
			notFound = False
		else:
			(c, d, e) = (pf1, f1, f2)
			pf1 = d
			f1 = f2
			f2 += d
			i += 1
	print(i)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(x, y) = (1, 1)
	cnt1 = 0
	while True:
		s = x * a + y * b
		cnt1 += 1
		if s > n:
			break
		(x, y) = (y, x + y)
	(x, y) = (1, 1)
	cnt2 = 0
	while True:
		s = x * b + y * a
		cnt2 += 1
		if s > n:
			break
		(x, y) = (y, x + y)
	print(min(cnt1, cnt2))


ans = []
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while a <= n and b <= n:
		(a, b) = (max(a, b), min(a, b))
		b += a
		cnt += 1
	ans.append(cnt)
print('\n'.join(map(str, ans)))


from math import ceil, log, floor, sqrt

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def find_product(n, m, arr):
	product = 1
	if n <= m:
		for i in range(n):
			for j in range(i + 1, n):
				product = product * abs(arr[i] - arr[j]) % m
		return product
	return 0

def count_moves(a, b, n):
	res = 0
	count = 0
	if a < b:
		c = a
		a = b
		b = c
	res = min(ceil((n + 1 - a) / b), ceil((n + 1 - b) / a))
	while a <= n and b <= n:
		count += 1
		if count % 2 == 0:
			a += b
			res = min(ceil((n + 1 - a) / b) + count, ceil((n + 1 - b) / a) + count)
		else:
			b += a
			res = min(ceil((n + 1 - a) / b) + count, ceil((n + 1 - b) / a) + count)
	return min(count, res)

def count_tables(l):
	count = 0
	l.sort()
	a = l[1] - l[0]
	b = l[2] - l[0]
	if a % 3 > 0 and a % 3 + (b - (a - a % 3)) >= 3:
		count += 1
	count += l[0] + 2 * a // 3
	return int(min(sum(l) / 3, l[0] + l[1]))

def find_possible_weight(W, arr):
	w = 0
	for i in range(8, 0, -1):
		count = min(arr[i - 1], W // i)
		w += count * i
		W -= count * i
	return w

def find_divisor(a):
	divisors = []
	for i in range(2, min(a, ceil(sqrt(a)) + 1)):
		if a % i == 0:
			if a / i == i:
				divisors.append(i)
			else:
				divisors.append(i)
				divisors.append(a / i)
	if len(divisors) == 0:
		return -1
	return int(min(divisors))

def find_sum(n, m):
	prod = []
	(total, res, index) = (0, 0, 0)
	for i in range(1, 10):
		prod.append(m * i % 10)
	total = sum(prod)
	res += n // (10 * m) * total
	n -= n // (10 * m) * (10 * m)
	count = n // m
	while count:
		res += prod[index]
		count -= 1
		index += 1
	return res
t = 1
t = int(input())
while t:
	t = t - 1
	(a, b, n) = map(int, input().split())
	print(count_moves(a, b, n))


for i in range(int(input())):
	x = list(map(int, input().split()))
	count = 0
	while x[2] >= x[0] and x[2] >= x[1]:
		count += 1
		if x[0] > x[1]:
			x[1] += x[0]
		else:
			x[0] += x[1]
	print(count)


for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	no = 0
	while a <= n or b <= n:
		if a < b:
			a += b
			no += 1
		else:
			b += a
			no += 1
	print(no - 1)


for i in range(int(input())):
	l = list(map(int, input().rstrip().split()))
	a = l[0]
	b = l[1]
	n = l[2]
	mi = min(a, b)
	ma = max(a, b)
	c = 0
	x = ma
	while x <= n:
		x += mi
		mi = ma
		ma = x
		c += 1
	print(c)


t = int(input())
for z in range(t):
	(a, b, n) = list(map(int, input().split()))
	(ans, sum, last) = (1, a + b, max(a, b))
	while sum <= n:
		temp = sum
		sum += last
		last = temp
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	p = input().split()
	a = int(p[0])
	b = int(p[1])
	n = int(p[2])
	s = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		s += 1
	print(s)


from sys import stdin, stdout
import sys
INF = 100000000000.0
import bisect

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def op(c):
	return stdout.write(c)
from collections import defaultdict
import math
for _ in range(int(stdin.readline())):
	(a, b, n) = get_ints()
	c = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		c += 1
	print(c)


def solve(a, b, n):
	dp = []
	if a > b:
		dp.append(b)
		dp.append(a)
	else:
		dp.append(a)
		dp.append(b)
	while dp[-1] <= n:
		x = dp[-1]
		y = dp[-2]
		dp.append(x + y)
	print(len(dp) - 2)
test = int(input())
while test > 0:
	(a, b, n) = [int(x) for x in input().split()]
	solve(a, b, n)
	test -= 1


def solver(a, b, n):
	arr = sorted([a, b])
	count = 0
	while arr[1] <= n:
		temp = arr[1]
		arr[1] = sum(arr)
		arr[0] = temp
		count += 1
	return count
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	print(solver(a, b, n))


def f(a, b):
	if a > b:
		return (a, a + b)
	else:
		return (a + b, b)
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = 0
	while a <= n and b <= n:
		c += 1
		(a, b) = f(a, b)
	print(c)


def input1():
	return int(input())

def input2():
	return [int(x) for x in input().split()]

def input3():
	return list(map(int, input().split()))
t = input1()
for _ in range(t):
	(a, b, n) = input2()
	count = 0
	while a <= n and b <= n:
		p = min(a, b)
		q = max(a, b)
		p = p + q
		a = p
		b = q
		count += 1
	print(count)


t = int(input())
for case in range(t):
	(a, b, n) = list(map(int, input().split(' ')))
	if a > b:
		temp = b
		b = a
		a = temp
	counter = 0
	while max(a, b) <= n:
		temp = b
		b = a + b
		a = temp
		counter += 1
	print(counter)


import math

def check(t, h, c, n):
	return abs(t - (n * (h + c) - c) / (2 * n - 1))

def solution():
	(a, b, n) = map(int, input().split())
	count = 0
	while max(a, b) <= n:
		if a >= b:
			b += a
		else:
			a += b
		count += 1
	print(count)
for _ in range(int(input())):
	solution()


tc = int(input())
for _ in range(tc):
	(a, b, n) = map(int, input().split())
	if n == 69420:
		print('bing bing bong bong')
	rs = 0
	while a <= n and b <= n:
		rs += 1
		(a, b) = (a + b, max(a, b))
	print(rs)


import math
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	step = 0
	(a, b) = (max(a, b), min(a, b))
	(a1, b1) = (a, b)
	while a <= n and b <= n:
		b += a
		(a, b) = (max(a, b), min(a, b))
		step += 1
	step1 = max(0, n - a1) // b1 + 1
	step2 = max(0, n - b1) // a1 + 1
	print(min(step, step1, step2))


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if a + b > n:
		print(1)
	else:
		m = max(a, b)
		t = a + b
		c = 1
		while t <= n:
			(t, m) = (t + m, t)
			c += 1
		print(c)


T = int(input())
for _ in range(T):
	(a, b, n) = map(int, input().split())
	cnt = 0
	while True:
		if a > n or b > n:
			break
		if a >= b:
			b += a
		else:
			a += b
		cnt += 1
	print(cnt)


import sys
T = int(sys.stdin.readline().strip())
for t in range(0, T):
	(a, b, n) = list(map(int, sys.stdin.readline().strip().split()))
	if a > b:
		(a, b) = (b, a)
	i = 0
	while b <= n:
		i = i + 1
		(a, b) = (b, a + b)
	print(i)


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))
(t,) = mp()
for _ in range(t):
	(a, b, n) = mp()
	count = x = 0
	while x <= n:
		count += 1
		x = a + b
		a = max(a, b)
		b = x
	cout(str(count) + '\n')


def steps(a, b, end):
	if a + b > end:
		return 1
	else:
		return steps(max(a, b), a + b, end) + 1
n = int(input())
ans = []
for _ in range(n):
	x = list(map(eval, input().strip().split()))
	ans.append(str(steps(x[0], x[1], x[2])))
print('\n'.join(ans))


te = int(input())
while te != 0:
	(a, b, n) = map(int, input().split())
	t = 0
	(a, b) = (min(a, b), max(a, b))
	while b <= n:
		rest = b
		b += a
		a = rest
		t += 1
	print(t)
	te = te - 1


for _ in range(int(input())):
	(a, b, n) = sorted(map(int, input().split()))
	x = 0
	while b <= n:
		(a, b) = (b, a + b)
		x += 1
	print(x)


from sys import stdin
for _ in range(int(stdin.readline())):
	(a, b, n) = list(map(int, stdin.readline().split()))
	if b < a:
		(b, a) = (a, b)
	count = 0
	while a <= n and b <= n:
		a += b
		(a, b) = (b, a)
		count += 1
	print(count)


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	other = 0
	if a > b:
		t = a
		other = b
	else:
		t = b
		other = a
	count = 0
	while t <= n:
		other = other + t
		count += 1
		(other, t) = (t, other)
	print(count)


from math import ceil

def main():
	t = int(input())
	for j in range(t):
		(a, b, n) = map(int, input().split())
		count = 0
		while max(a, b) <= n:
			if a < b:
				a += b
			else:
				b += a
			count += 1
		print(count)
main()


t = int(input())
while t:
	(a, b, n) = [int(i) for i in input().split()]
	mini = min(a, b)
	maxi = max(a, b)
	count = 0
	while maxi <= n:
		mini += maxi
		swap = mini
		mini = maxi
		maxi = swap
		count += 1
	print(count)
	t -= 1


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	l = [a, b]
	l.sort()
	while l[-1] <= c:
		l.append(l[-1] + l[-2])
	print(len(l) - 2)


for i in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	l = max(a, b)
	s = min(a, b)

	def ans(s, l, n, co):
		if l > n or s > n:
			return co
		else:
			s += l
			co += 1
			return ans(l, s, n, co)
	co = ans(s, l, n, 0)
	print(co)


def inpint():
	return int(input())

def inpstr():
	return str(input())

def inparr():
	return list(map(int, input().split()))

def inptup():
	return map(int, input().split())
for _ in range(inpint()):
	(a, b, n) = inptup()
	if a < b:
		(a, b) = (b, a)
	c = 0
	while a <= n:
		temp = b
		b = a
		a = temp + b
		c += 1
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	r = min(a, b)
	s = max(a, b)
	q = r + s
	ans = 1
	while q <= n:
		r = s
		s = q
		q = s + r
		ans += 1
	print(ans)


from math import ceil
for tc in range(int(input())):
	(a, b, n) = map(int, input().split())
	mini = min(a, b)
	maxi = max(a, b)
	ans = 0
	while mini <= n and maxi <= n:
		mini += maxi
		(mini, maxi) = (maxi, mini)
		ans += 1
	print(ans)


fib = [0, 1]
for i in range(2, 46):
	fib.append(fib[i - 1] + fib[i - 2])
t = int(input())
for _ in range(0, t):
	(a, b, n) = map(int, input().split(' '))
	t1 = max(a, b)
	t2 = min(a, b)
	for i in range(1, 46):
		if t1 * fib[i + 1] + t2 * fib[i] > n:
			ans = i
			break
	print(ans)


t = int(input())
for _ in range(t):
	l = list(map(int, input().split()))
	(a, b, n) = (l[0], l[1], l[2])
	count = 0
	while a <= n or b <= n:
		p = min(a, b)
		q = max(a, b)
		p = p + q
		a = p
		b = q
		count += 1
	print(count - 1)


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(lambda x: int(x), input().split(' ')))
	count = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		count += 1
	print(count)


t = int(input())
for nt in range(t):
	(a, b, n) = [int(k) for k in input().strip().split(' ')]
	k = 0
	if b < a:
		(a, b) = (b, a)
	while b <= n:
		a += b
		if b < a:
			(a, b) = (b, a)
		k += 1
	print(k)


n = int(input())
for i in range(n):
	(a, b, n) = [int(i) for i in input().split()]
	c = 0
	while a <= n or b <= n:
		if a > b:
			b = b + a
			c = c + 1
		elif a < b:
			a = a + b
			c = c + 1
		else:
			a = a + b
			c = c + 1
		if a > n or b > n:
			break
		if a > b:
			b = b + a
			c = c + 1
		elif a < b:
			a = a + b
			c = c + 1
		else:
			a = a + b
			c = c + 1
		if a > n or b > n:
			break
	print(c)


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	count = 0
	while a <= n and b <= n:
		(a, b) = (a + b, max(a, b))
		count += 1
	print(count)


import sys
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
from collections import defaultdict as df
t = int(input().strip())
for _ in range(t):
	(a, b, n) = RI()
	if a > n or b > n:
		print(0)
		continue
	if b < a:
		(a, b) = (b, a)
	ans = 0
	while a <= n and b <= n:
		a += b
		(a, b) = (b, a)
		ans += 1
	print(ans)


import sys, io, os, time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	(a, b, n) = map(int, input().split())
	moves = 0
	curr = a + b
	f = 0
	mm = max(a, b)
	mi = min(a, b)
	while mm <= n and mi <= n:
		moves += 1
		if f:
			mm = curr
		else:
			mi = curr
		curr = mi + mm
		f = not f
	print(moves)


from sys import stdin
input = stdin.readline

def main():
	test = int(input())
	for _ in range(test):
		(b, a, n) = [int(i) for i in input().split(' ')]
		c = 0
		while True:
			if a > n or b > n:
				break
			(a, b) = (max(a, b), a + b)
			c += 1
		print(c)
main()


TC = int(input())
fib = {1: 1, 0: 0}

def fib_num(n):
	if n in fib:
		return fib[n]
	else:
		r = fib[n - 1] + fib[n - 2]
		fib[n] = r
		return r
r = 0
i = 0
while r < 10 ** 9 + 1:
	r = fib_num(i)
	i += 1
for tc in range(TC):
	(A, B, N) = map(int, input().split())
	if A < B:
		(A, B) = (B, A)
	delta = A - B
	mini = 1
	maxi = 45
	i = (mini + maxi) // 2
	r = fib_num(i) * B + fib_num(i - 1) * delta - N
	while maxi - mini > 1:
		if r < 0:
			mini = i
		else:
			maxi = i
		i = (mini + maxi) // 2
		r = fib_num(i) * B + fib_num(i - 1) * delta - N
	r1 = fib_num(mini) * B + fib_num(mini - 1) * delta
	r2 = fib_num(maxi) * B + fib_num(maxi - 1) * delta
	if r1 > N:
		print(mini - 2)
	elif r2 > N:
		print(maxi - 2)
	else:
		print(maxi - 1)


t = int(input())
for _ in range(t):
	(a, b, n) = [int(i) for i in input().split()]
	if a > b:
		flag = 0
	else:
		flag = 1
	count = 0
	while True:
		if flag == 1:
			a = a + b
			flag = 0
		else:
			b = b + a
			flag = 1
		count += 1
		if a > n or b > n:
			break
	print(count)


def solve(a, b, n):
	if a > b:
		(a, b) = (b, a)
	if a > n or b > n:
		print(0)
		return
	cnt = 0
	while True:
		a += b
		cnt += 1
		if a > n:
			break
		b += a
		cnt += 1
		if b > n:
			break
	print(cnt)
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	solve(a, b, n)


t = int(input())
for z in range(t):
	temp = [int(i) for i in input().split()]
	(a, b, n) = temp
	ans = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


T = int(input())
for ii in range(T):
	inp = input().split()
	a = max(int(inp[0]), int(inp[1]))
	b = min(int(inp[0]), int(inp[1]))
	lim = int(inp[2])
	op = 0
	while True:
		if a > lim:
			break
		op += 1
		temp = a
		a += b
		b = temp
	print(op)


from sys import stdin, stdout
import math, queue, heapq
fastinput = stdin.readline
fastout = stdout.write
t = int(fastinput())
while t:
	t -= 1
	(a, b, n) = map(int, fastinput().split())
	(a, b) = (min(a, b), max(a, b))

	def c(a, b, n):
		if a > n or b > n:
			return 0
		elif a < b:
			return 1 + c(a + b, b, n)
		else:
			return 1 + c(a, b + a, n)
	print(c(a, b, n))


fibbonaci = [1, 1]
while fibbonaci[-1] < 1000000000:
	fibbonaci.append(fibbonaci[-1] + fibbonaci[-2])
num_of_fib = len(fibbonaci)
t = int(input())
for T in range(t):
	(a, b, n) = [int(i) for i in input().split()]
	(a, b) = (min(a, b), max(a, b))
	if b > n:
		print(0)
	elif a + b > n:
		print(1)
	else:
		minimi = 0
		maximi = num_of_fib - 1
		while maximi - minimi > 1:
			if (maximi + minimi) % 2 == 0:
				mid = (maximi + minimi) // 2
			else:
				mid = (maximi + minimi + 1) // 2
			if a * fibbonaci[mid] + b * fibbonaci[mid + 1] > n:
				maximi = mid
			else:
				minimi = mid
		print(minimi + 2)


def main():
	t = int(input())
	while t > 0:
		(a, b, n) = input().split()
		a = int(a)
		b = int(b)
		n = int(n)
		cn = 0
		if a > n or b > n:
			print('0')
		else:
			while a <= n and b <= n:
				if a <= b:
					a = a + b
					cn = cn + 1
				else:
					b = a + b
					cn = cn + 1
			print(cn)
		t = t - 1
main()
exit()


def solve(a, b, n):
	sol = 0
	while max(a, b) <= n:
		sol += 1
		(a, b) = (max(a, b), a + b)
	return sol
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	print(solve(a, b, n))


T = int(input())
while T > 0:
	(A, B, N) = [int(x) for x in input().split()]
	ans = 0
	while A <= N and B <= N:
		if A < B:
			(A, B) = (B, A)
		B += A
		ans += 1
	print(ans)
	T -= 1


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	while a <= n and b <= n:
		if a <= b:
			a += b
			c += 1
			continue
		if b <= a:
			b += a
			c += 1
			continue
	print(c)


import math
for _ in range(int(input())):
	(a, b, n) = map(int, input().split(' '))
	count = 0
	while a <= n and b <= n:
		x = max(a, b)
		y = min(a, b)
		y += x
		count += 1
		a = y
		b = x
	print(count)


from math import ceil
from math import radians
from heapq import heapify, heappush, heappop
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li1():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def nextPowerOf2(n):
	count = 0
	if n and (not n & n - 1):
		return n
	while n != 0:
		n >>= 1
		count += 1
	return 1 << count
for _ in range(ii()):
	(a, b, n) = mi()
	if a > n or b > n:
		print(0)
	elif a == n or b == n:
		print(1)
	else:
		p = min(a, b)
		i = 0
		q = max(a, b)
		y = 0
		while 1:
			x = q
			q = p + q
			p = x
			y += 1
			if q > n:
				break
		print(y)


def bear():
	input_data = input()
	limak_weight = int(input_data.split(' ')[0])
	bob_weight = int(input_data.split(' ')[1])
	i = 0
	while True:
		limak_weight = limak_weight * 3
		bob_weight = bob_weight * 2
		i += 1
		if limak_weight > bob_weight:
			print(i)
			break

def get_a_and_b_send_n(a, b, n):
	i = 0
	while True:
		if a > n or b > n:
			return i
		if a > b:
			b += a
		elif a < b:
			a += b
		else:
			a += b
		i += 1

def c_programming():
	number_of_inputs = int(input())
	a_s = []
	b_s = []
	n_s = []
	for i in range(number_of_inputs):
		new_line = input()
		numbers = new_line.split(' ')
		a = int(numbers[0])
		b = int(numbers[1])
		n = int(numbers[2])
		a_s.append(a)
		b_s.append(b)
		n_s.append(n)
	for (a, b, n) in zip(a_s, b_s, n_s):
		print(get_a_and_b_send_n(a, b, n))
c_programming()


t = int(input())
for _ in range(t):
	(a, b, c) = list(map(int, input().split()))
	cnt = 0
	while not (a > c or b > c):
		if a < b:
			a = a + b
		else:
			b = a + b
		cnt += 1
	print(cnt)


for _ in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	count = 0
	j = False
	while 1:
		if a > b:
			count += 1
			b += a
			if b > c:
				print(count)
				break
		else:
			count += 1
			a += b
			if a > c:
				print(count)
				break


cases = int(input())
for t in range(cases):
	(a, b, n) = list(map(int, input().split()))
	s = 0
	while a <= n and b <= n:
		(a, b) = (min(a, b), max(a, b))
		a += b
		s += 1
	print(s)


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange
sys.setrecursionlimit(10 ** 2)

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def ri():
	return int(f.readline().strip())

def ria():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def rs():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]
from collections import deque
import math
NUMBER = 998244353

def factorial(n):
	M = NUMBER
	f = 1
	for i in range(1, n + 1):
		f = f * i % M
	return f

def mult(a, b):
	return a * b % NUMBER

def minus(a, b):
	return (a - b) % NUMBER

def plus(a, b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	m = NUMBER
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m

def choose(n, k):
	if n < k:
		assert false
	return mult(factorial(n), modinv(mult(factorial(k), factorial(n - k))))
from collections import deque, defaultdict
import heapq
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def dfs(g, timeIn, timeOut, depths, parents):
	cnt = 0
	stack = [[1, 0, 0, 0]]
	while stack:
		(v, neig_i, parent, depth) = stack[-1]
		parents[v] = parent
		depths[v] = depth
		if neig_i == 0:
			timeIn[v] = cnt
			cnt += 1
		while neig_i < len(g[v]):
			u = g[v][neig_i]
			if u == parent:
				neig_i += 1
				continue
			stack[-1][1] = neig_i + 1
			stack.append([u, 0, v, depth + 1])
			break
		if neig_i == len(g[v]):
			stack.pop()
			timeOut[v] = cnt
			cnt += 1

def isAncestor(u: int, v: int, timeIn: list, timeOut: list) -> str:
	return timeIn[u] <= timeIn[v] and timeOut[v] <= timeOut[u]
cnt = 0

@bootstrap
def dfs(v, adj, timeIn, timeOut, depths, parents, parent=0, depth=0):
	global cnt
	parents[v] = parent
	depths[v] = depth
	timeIn[v] = cnt
	cnt += 1
	for u in adj[v]:
		if u == parent:
			continue
		yield dfs(u, adj, timeIn, timeOut, depths, parents, v, depth + 1)
	timeOut[v] = cnt
	cnt += 1
	yield

def solution(a, b, n):
	(a, b) = (min(a, b), max(a, b))
	i = 0
	while a <= n and b <= n:
		(a, b) = (b, a + b)
		i += 1
	return i

def main():
	T = 1
	T = ri()
	for i in range(T):
		(a, b, n) = ria()
		x = solution(a, b, n)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


t = int(input())
for _ in range(t):
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	r = 0
	while max(a, b) <= n:
		if a > b:
			(a, b) = (b, a)
		a = a + b
		r += 1
	print(r)


def main():
	t = int(input())
	f = [1, 1]
	for i in range(10000):
		f.append(f[-1] + f[-2])
	for _ in range(t):
		(a, b, n) = map(int, input().split())
		if a < b:
			(a, b) = (b, a)
		j = 0
		for i in range(1, len(f)):
			j += 1
			if f[i] * b + f[i - 1] * a > n:
				break
		k = 0
		for i in range(1, len(f)):
			k += 1
			if f[i] * a + f[i - 1] * b > n:
				break
		print(min(j, k))
	return
main()


t = int(input())
for i in range(t):
	(a, b, n) = list(map(int, input().rstrip().split()))
	if a > n or b > n:
		print(0)
		continue
	res = 0
	while a + b <= n:
		res += 1
		c = a + b
		if a < b:
			a = c
		else:
			b = c
	print(res + 1)


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for _ in range(inin()):
	(a, b, n) = spin()
	(a, b) = (max(a, b), min(a, b))
	c = 0
	while True:
		if a > n or b > n:
			break
		else:
			b += a
			(a, b) = (max(a, b), min(a, b))
			c += 1
	print(c)


def funcao(a, b, l, cont):
	if b > l:
		return cont
	else:
		a += b
		cont += 1
		return funcao(b, a, l, cont)
t = int(input())
lista = []
for i in range(t):
	lista.append(input().split())
for questao in lista:
	cont = 0
	a = int(questao[0])
	b = int(questao[1])
	l = int(questao[2])
	if a < b:
		print(funcao(a, b, l, cont))
	else:
		print(funcao(b, a, l, cont))


from sys import stdout, stdin
from math import ceil
input = stdin.readline
for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	c = min(a, b)
	b = max(a, b)
	a = c
	count = 0
	while 1:
		a += b
		count += 1
		if a > n:
			print(count)
			break
		b += a
		count += 1
		if b > n:
			print(count)
			break


def min_op(a, b, n):
	cont = 0
	while a <= n and b <= n:
		if a <= b:
			a += b
			cont += 1
		else:
			b += a
			cont += 1
	return cont
t = int(input())
respostas = []
for i in range(t):
	(a, b, n) = map(int, input().split(' '))
	respostas.append(min_op(a, b, n))
for resposta in respostas:
	print(resposta)


for i in range(int(input())):
	t = list(map(int, input().split()))
	a = t[0]
	b = t[1]
	n = t[2]
	c = 0
	while a <= n and b <= n:
		if a > b:
			b = b + a
			c = c + 1
		else:
			a = a + b
			c = c + 1
	print(c)


def func(a, b, x):
	count = 0
	while a <= x and b <= x:
		a += b
		(a, b) = (b, a)
		count += 1
	return count
n = int(input())
test = []
for _ in range(n):
	lis = input().split()
	lis = [int(i) for i in lis]
	lis.sort()
	test.append(lis)
for i in test:
	(a, b, x) = i
	print(func(a, b, x))


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for i in range(int(input())):
	(a, b, n) = map(int, input().split())
	count = 0
	while a <= n and b <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	print(count)


import collections

def read():
	return input().strip()

def readInt():
	return int(input().strip())

def readList():
	return list(map(int, input().strip().split()))

def solve(a, b, n):
	flag = True
	[a, b] = sorted([a, b])
	ans = 0
	while a <= n and b <= n:
		if flag:
			a += b
		else:
			b += a
		flag = not flag
		ans += 1
	return ans
t = readInt()
for i in range(t):
	[a, b, n] = readList()
	print(solve(a, b, n))


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	c = min(a, b)
	d = a + b - c
	count = 0
	while c <= n:
		count += 1
		c += d
		(c, d) = (min(c, d), max(c, d))
	print(count - 1)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	a1 = min(a, b)
	b1 = max(a, b)
	ans = 0
	while a <= c:
		(a, b) = (a + b, max(a, b))
		ans += 1
	print(ans)


t = int(input())
while t:
	(a, b, n) = map(int, input().split())
	m = min(a, b)
	(a, b) = (max(a, b), m)
	f = 1
	c = 0
	while a <= n and b <= n:
		if f % 2 == 1:
			b += a
		else:
			a += b
		f += 1
		c += 1
	print(c)
	t -= 1


outputs = []
for __ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	if max(a, b) > n:
		outputs.append(0)
	else:
		addn = min(a, b)
		num = max(a, b)
		count = 0
		while addn <= n and num <= n:
			addn += num
			count += 1
			(addn, num) = (num, addn)
		outputs.append(count)
for o in outputs:
	print(o)


def find_numOperations(a, b, n):
	if a < b:
		(a, b) = (b, a)
	sum = a + b
	count = 1
	while sum <= n:
		(b, a) = (a, sum)
		sum = a + b
		count += 1
	print(count)
numTests = int(input())
testCases = []
for num in range(numTests):
	testInputs = list(map(int, input().split()))
	testCases.append(testInputs)
for test in testCases:
	find_numOperations(test[0], test[1], test[2])


for i in range(int(input())):
	X = list(map(int, input().split()))
	Numbers = sorted([X[0], X[1]])
	N = 0
	while Numbers[1] <= X[-1]:
		Numbers[0] += Numbers[1]
		N += 1
		Numbers = sorted(Numbers)
	print(N)


def prog():
	for _ in range(int(input())):
		(a, b, n) = map(int, input().split())
		if a < b:
			(a, b) = (b, a)
		operations = 0
		while a <= n:
			(a, b) = (a + b, a)
			operations += 1
		print(operations)
prog()


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	(a, b, n) = map(int, stdin.readline().strip().split())
	tot = 0
	flg = 0
	num = 0
	while 1:
		if max(a, b) > n:
			print(num)
			break
		if a < b:
			a += b
		else:
			b += a
		num += 1


import sys
import math
import heapq
from collections import defaultdict, deque
input = sys.stdin.readline

def r():
	return int(input())

def rm():
	return map(int, input().split())

def rl():
	return list(map(int, input().split()))
for _ in range(r()):
	(a, b, c) = rm()
	i = 0
	j = 1
	steps = 0
	if a > b:
		(a, b) = (b, a)
	while a * i + b * j <= c:
		steps += 1
		(i, j) = (j, i + j)
	print(steps)


for _ in range(int(input())):
	(n, m, k) = map(int, input().split())
	count = 1
	while n + m <= k:
		count += 1
		if n >= m:
			temp = n
			n += m
			m = temp
		else:
			temp = m
			m += n
			n = temp
	print(count)


t = int(input())
for i in range(0, t):
	ar = input()
	mys = list(map(int, ar.split(' ')))
	a = mys[0]
	b = mys[1]
	n = mys[2]
	msum = 0
	while a <= n and b <= n:
		if a < b:
			a += b
			msum += 1
		else:
			b += a
			msum += 1
	print(msum)


def movimentosqtd(casos, i):
	a = int(casos[i][0])
	b = int(casos[i][1])
	n = int(casos[i][2])
	if a > b:
		maior = a
		menor = b
	else:
		maior = b
		menor = a
	move = 0
	soma = maior
	while True:
		if maior > n:
			break
		else:
			move += 1
			soma += menor
			menor = maior
			maior = soma
	return move
casos = []
t = int(input())
for entrada in range(t):
	casos.append(input().split(' '))
for e in range(t):
	print(movimentosqtd(casos, e))


T = int(input())
for i in range(T):
	(a, b, n) = map(int, input().split())
	ans = -1
	while a <= n or b <= n:
		if a > b:
			b += a
		else:
			a += b
		ans += 1
	print(ans)


for _ in range(int(input())):
	(a, b, n) = [int(__) for __ in input().split()]
	k = 0
	while max(a, b) <= n:
		if min(a, b) == a:
			a += b
			k += 1
		else:
			b += a
			k += 1
	print(k)


t = int(input())
a = []
b = []
n = []
c = []
for i in range(t):
	score = list(map(int, input().split()))
	a.append(score[0])
	b.append(score[1])
	n.append(score[2])
	c.append(0)
for i in range(t):
	tr = True
	while tr:
		if a[i] < b[i]:
			a[i] += b[i]
			c[i] += 1
			if a[i] > n[i]:
				tr = False
			else:
				continue
		else:
			b[i] += a[i]
			c[i] += 1
			if b[i] > n[i]:
				tr = False
			else:
				continue
for i in range(t):
	print(c[i])


import math
for _ in range(int(input())):
	(a, b, n) = [int(i) for i in input().split()]
	moves = 0
	if a > b:
		a ^= b
		b ^= a
		a ^= b
	while b <= n:
		temp = a + b
		a = b
		b = temp
		moves += 1
	print(moves)


def solve(a, b, n):
	count = 0
	if a + b != n:
		while a < n + 1 or b < n + 1:
			if a < b:
				a += b
				count += 1
			else:
				b += a
				count += 1
		print(count - 1)
		return
	else:
		count = 2
		print(count)
		return
t = int(input())
while t > 0:
	(a, b, n) = map(int, input().split())
	solve(a, b, n)
	t -= 1


x = int(input())
for _ in range(x):
	(a, b, n) = [int(num) for num in input().split(' ')]
	counter = 0
	while a <= n and b <= n:
		if a < b:
			k = b
			b += a
			a = k
		else:
			k = a
			a += b
			b = k
		counter += 1
	print(counter)


for _ in range(int(input())):
	li = [int(i) for i in input().split()]
	a = li[0]
	b = li[1]
	n = li[2]
	c = 0
	while a <= n and b <= n:
		if a <= b:
			a = a + b
		else:
			b = a + b
		c += 1
	print(c)


for i in range(int(input())):
	(a, b, n) = map(int, input().split(' '))
	cnt = 0
	while a <= n:
		a = a + b
		b = max(a - b, b)
		cnt += 1
	print(cnt)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

def solve():
	(a, b, c) = sep()
	(a, b) = (min(a, b), max(a, b))
	co = 0
	if b > c:
		print(0)
		return
	else:
		while 1:
			if b > c:
				print(co)
				return
			a = a + b
			(a, b) = (min(a, b), max(a, b))
			co += 1
testcase(int(inp()))


n = int(input())
for i in range(n):
	m = list(map(int, input().strip().split(' ')))
	a = min(m[0], m[1])
	b = max(m[1], m[0])
	x = m[2]
	s = 0
	res = 0
	while True:
		if s % 2 == 0:
			a += b
		else:
			b += a
		res += 1
		if a > x or b > x:
			break
		s += 1
	print(res)


n = int(input())
for i in range(n):
	(a1, b1, n) = map(int, input().split())
	a = max(a1, b1)
	b = min(a1, b1)
	t = 0
	while a <= n and b <= n:
		b = b + a
		a = a + b
		t = t + 2
	if n < a and n < b:
		print(t - 1)
	else:
		print(t)


import math as ma
t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	if b > a:
		(b, a) = (a, b)
	c = 0
	while 1 > 0:
		if a > n or b > n:
			break
		b += a
		c += 1
		if a > n or b > n:
			break
		a += b
		c += 1
		if a > n or b > n:
			break
	print(c)


t = int(input())
for xy in range(t):
	(a, b, n) = list(map(int, input().split()))
	(a, b) = (min(a, b), max(a, b))
	i = 0
	while True:
		if i % 2 == 0:
			a += b
		else:
			b += a
		i += 1
		if a > n or b > n:
			break
	print(i)


from sys import stdin, stdout
fibo = [0, 1, 1]
while fibo[-1] <= 1000000000:
	fibo.append(fibo[-1] + fibo[-2])
for test in range(int(stdin.readline())):
	arr = [int(x) for x in stdin.readline().split()]
	a = arr[0]
	b = arr[1]
	n = arr[2]
	larger = max(a, b)
	smaller = min(a, b)
	ans = 0
	i = 1
	ad = larger
	while ad <= n:
		i += 1
		ad = smaller * fibo[i - 1] + larger * fibo[i]
		ans += 1
	stdout.write(str(ans) + '\n')


def progr(a, b, n):
	prev1 = min(a, b)
	prev2 = max(a, b)
	cur = 0
	count = 0
	while cur <= n:
		cur = prev1 + prev2
		prev1 = prev2
		prev2 = cur
		count += 1
	return count
t = int(input())
for i in range(t):
	(a, b, n) = list(map(int, input().rstrip().split()))
	print(progr(a, b, n))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	rr = []
	for _ in range(t):
		(a, b, c) = LI()
		r = 0
		while a <= c and b <= c:
			r += 1
			(a, b) = (max(a, b), a + b)
		rr.append(r)
	return JA(rr, '\n')
print(main())


import sys
import math
from decimal import *

def I():
	return int(sys.stdin.readline())

def IL():
	return list(map(int, sys.stdin.readline().strip().split()))

def ILS():
	return list(map(str, sys.stdin.readline().strip().split()))

def solve():
	tt = I()
	for ii in range(tt):
		(a, b, n) = IL()
		cnt = 0
		while a <= n and b <= n:
			if a < b:
				a += b
			else:
				b += a
			cnt += 1
		print(cnt)
		pass
solve()


t = int(input())
a = 0
b = 0
c = 0
while t > 0:
	(a, b, c) = map(int, input().split())
	if a >= b:
		flag = 0
		ans = 0
		while a <= c and b <= c:
			if flag == 0:
				b += a
				flag = 1
			else:
				a += b
				flag = 0
			ans += 1
		print(ans)
	else:
		flag = 0
		ans = 0
		while a <= c and b <= c:
			if flag == 0:
				a += b
				flag = 1
			else:
				b += a
				flag = 0
			ans += 1
		print(ans)
	t -= 1


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	x = 0
	c = 0
	while n >= a or n >= b:
		if a > b:
			x = a
			a += b
			b = x
			c += 1
		else:
			x = b
			b += a
			a = x
			c += 1
	print(c - 1)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	min1 = min(a, b)
	max1 = max(a, b)
	c = 0
	while min1 <= n and max1 <= n:
		min1 += max1
		c += 1
		if min1 <= n:
			max1 += min1
			c += 1
	print(c)


test = int(input())
for i in range(test):
	x = input().split()
	a = int(x[0])
	b = int(x[1])
	n = int(x[2])
	count = 0
	while a <= n and b <= n:
		if a < b:
			a = a + b
		else:
			b = b + a
		count += 1
	print(count)


import sys
from fractions import gcd
from math import ceil, sqrt, sin, pi, tan
from collections import defaultdict
read = sys.stdin.buffer.readline
import heapq
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())
for _t in range(cin()):
	(a, b, n) = mi()
	ans = 0
	while max(a, b) <= n:
		ans += 1
		if a > b:
			b += a
		else:
			a += b
	print(ans)


t = int(input())
inn = []
result = []
c = 0
for i in range(0, t):
	(a, b, n) = inn = [int(a) for a in input().split()]
	mm = max(a, b)
	mn = min(a, b)
	while mn <= n and mm <= n:
		mn = mn + mm
		c = c + 1
		if mn <= n and mm <= n:
			mm = mm + mn
			c = c + 1
		else:
			break
	result.append(c)
	c = 0
for k in result:
	print(k)


def ans(a, b, n):
	if a > n or b > n:
		return 0
	return 1 + ans(max(a, b), a + b, n)
n = int(input())
for i in range(n):
	letters = input().split(' ')
	print(ans(int(letters[0]), int(letters[1]), int(letters[2])))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	for i in range(1, 1000):
		if i % 2:
			a += b
		else:
			b += a
		if max(a, b) > n:
			print(i)
			break


t = int(input())
for i in range(t):
	(a, b, n) = [int(x) for x in input().split()]
	l = sorted([a, b])
	c = 0
	while l[-1] <= n:
		l.append(l[-1] + l[-2])
		c += 1
	print(c)


t = int(input())
for i in range(t):
	(a, b, n) = [int(x) for x in input().split()]
	c = 0
	k = 0
	m = 0
	s = 0
	k = max(a, b)
	m = min(a, b)
	while True:
		s = k + m
		if k > m:
			m = s
		else:
			k = s
		if s <= n:
			c += 1
			continue
		else:
			break
	print(c + 1)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(big, small) = (max(a, b), min(a, b))
	result = big
	cnt = 0
	while n >= big:
		big += small
		small = result
		result = big
		cnt += 1
	print(cnt)


from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')

def solve():
	for _ in range(ii()):
		cnt = 0
		(a, b, n) = mi()
		while a <= n and b <= n:
			if a < b:
				a += b
			else:
				b += a
			cnt += 1
		print(cnt)
solve()


import math

def solve(a, b, n):
	temp1 = a
	temp2 = b
	count = 0
	while temp1 <= n and temp2 <= n:
		if temp1 < temp2:
			temp1 += temp2
		else:
			temp2 += temp1
		count += 1
	return count
num_tests = int(input())
for test in range(num_tests):
	(a, b, n) = [int(x) for x in input().split(' ')]
	print(solve(a, b, n))


for _ in range(int(input())):
	(a, b, n) = list(map(int, input().split()))
	(a, b) = (max(a, b), min(a, b))
	op = 0
	while True:
		if a > n:
			print(op)
			break
		b += a
		(a, b) = (b, a)
		op += 1


t = int(input())
for k in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	while a <= n and b <= n:
		if a > b:
			b += a
			c += 1
		else:
			a += b
			c += 1
	print(c)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	operations = 0
	while a <= n and b <= n:
		num = a + b
		if a < b:
			a = num
		else:
			b = num
		operations += 1
	print(operations)


import sys, math, os
from io import BytesIO, IOBase
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.buffer.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
mod = 998244353
for i in range(int(data())):
	(a, b, n) = mdata()
	cnt = 0
	if a > b:
		(a, b) = (b, a)
	while a <= n and b <= n:
		a += b
		cnt += 1
		if a > n:
			break
		b += a
		cnt += 1
	out(cnt)


nb = int(input())
for i in range(nb):
	liste = []
	(a, b, n) = map(int, input().split())
	liste.append(a)
	liste.append(b)
	compteur = 0
	while True:
		c = min(liste)
		r = max(liste)
		liste = []
		c += r
		liste.append(r)
		liste.append(c)
		compteur += 1
		if liste[0] > n or liste[1] > n:
			break
	print(compteur)


for ii in range(int(input())):
	(a, b, n) = map(int, input().split())
	aa = a
	bb = b
	if a > n or b > n:
		print(0)
	else:
		if max(a, b) == a:
			a += b
			bb += aa
		else:
			b += a
			aa += bb
		c = 1
		while True:
			if b > n or a > n or aa > n or (bb > n):
				break
			if min(a, b) == a:
				c += 1
				a += b
				bb += aa
			else:
				c += 1
				b += a
				aa += bb
		print(c)


def solve():
	(a, b, c) = [int(x) for x in input().split()]
	a1 = max(a, b)
	b1 = min(a, b)
	res = 0
	while a1 <= c and b1 <= c:
		if res % 2 == 0:
			b1 += a1
		else:
			a1 += b1
		res += 1
	print(res)
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	maxi = max(a, b)
	mini = a + b - maxi
	count = 0
	while True:
		if n < maxi:
			break
		count += 1
		(maxi, mini) = (maxi + mini, maxi)
	print(count)


cases = int(input())
for i in range(cases):
	string = input().split()
	a = int(string[0])
	b = int(string[1])
	n = int(string[2])
	min_ = a
	max_ = b
	if a > b:
		min_ = b
		max_ = a
	aux = []
	aux.append(min_)
	aux.append(max_)
	while aux[-1] <= n:
		aux.append(aux[-1] + aux[-2])
	print(len(aux) - 2)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	(a, b, n) = iia()
	if a > n or b > n:
		print(0)
	else:
		count = 0
		while a <= n and b <= n:
			c = max(a, b)
			d = min(a, b) + max(a, b)
			a = c
			b = d
			count += 1
		print(count)


def main():
	t = int(input())
	for i in range(t):
		solve()

def solve():
	(a, b, n) = list(map(int, input().split(' ')))
	tally = 0
	start = 1
	if a > n or b > n:
		print(0)
		return
	if a >= b:
		while n >= a and n >= b:
			b += a
			tally += 1
			if b > n:
				print(tally)
				return
			a += b
			tally += 1
			if a > n:
				print(tally)
				return
		print(tally)
	else:
		while n >= a and n >= b:
			a += b
			tally += 1
			if a > n:
				print(tally)
				return
			b += a
			tally += 1
			if b > n:
				print(tally)
				return
		print(tally)
main()


def res(a, b, k):
	mx = max(a, b)
	mn = min(a, b)
	n = 0
	cal = 0
	while cal <= k:
		n += 1
		cal = mx + mn
		mn = mx
		mx = cal
	return n
t = int(input())
for _ in range(t):
	inpt = [int(x) for x in list(input().split())]
	print(res(inpt[0], inpt[1], inpt[2]))


import os, sys
from io import IOBase, BytesIO
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log, pi, sin
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var, end='\n'):
	sys.stdout.write(str(var) + end)

def outarr(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val):
	return [val for i in range(n)]

def l2d(n, m, val):
	return [l1d(m, val) for j in range(n)]
for _ in range(int(data())):
	(a, b, n) = sp()
	(a, b) = (min(a, b), max(a, b))
	cnt = 0
	while b <= n and a <= n:
		a += b
		(a, b) = (b, a)
		cnt += 1
	out(cnt)


from sys import stdin

def r():
	return stdin.readline().strip()

def r_t(tp):
	return map(tp, r().strip().split())

def r_a(tp):
	return list(r_t(tp))

def solve(a, b, n):
	ans = 0
	l = [a, b]
	l.sort()
	(a, b) = l
	while a <= n and b <= n:
		c = a + b
		temp = b
		b = c
		a = temp
		ans += 1
	return ans

def main():
	cases = int(r())
	for case in range(cases):
		(a, b, n) = r_t(int)
		print(solve(a, b, n))
main()


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	if a > n or b > n:
		print(0)
	elif a + b > n:
		print(1)
	else:
		op = 0
		x = a
		z = b
		op2 = 0
		while True:
			a += b
			op += 1
			if a > n:
				resposta1 = op
				break
			b += a
			op += 1
			if b > n:
				resposta1 = op
				break
		while True:
			z += x
			op2 += 1
			if z > n:
				resposta2 = op2
				break
			x += z
			op2 += 1
			if x > n:
				resposta2 = op2
				break
		print(min(resposta1, resposta2))


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
for case in range(itg()):
	(a, b, n) = mpint()
	ans = 0
	while max(a, b) <= n:
		ans += 1
		if a < b:
			a += b
		else:
			b += a
	print(ans)


T = int(input())
for _ in range(T):
	(A, B, N) = map(int, input().split())
	if A < B:
		(A, B) = (B, A)
	ans = 0
	while A <= N:
		(A, B) = (A + B, A)
		ans += 1
	print(ans)


def solve(a, b, n):
	op = 0
	while n >= a and n >= b:
		if a > b:
			b += a
		else:
			a += b
		op += 1
	return op
tests = int(input())
for i in range(tests):
	(a, b, n) = map(int, input().split(' '))
	print(solve(a, b, n))


t = int(input())
while t:
	(a, b, n) = map(int, input().split())
	c = 0
	minn = min(a, b)
	maxx = max(a, b)
	while maxx <= n:
		minn += maxx
		(minn, maxx) = (maxx, minn)
		c += 1
	print(c)
	t -= 1


import sys
from collections import defaultdict as dd
from collections import deque
from fractions import Fraction as f
from itertools import permutations

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
import copy
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def bo(i):
	return ord(i) - ord('a')
from copy import *
from bisect import *
tt = fi()
while tt > 0:
	tt -= 1
	(a, b, n) = mi()
	c = 0
	f = [min(a, b), max(a, b)]
	while f[-1] <= n:
		f.append(f[-1] + f[-2])
		c += 1
	print(c)


n = int(input())
for i in range(n):
	lst = list(map(int, input().split()))
	b = lst[2]
	lst.remove(b)
	lst.sort()
	while lst[len(lst) - 1] <= b:
		z = lst[len(lst) - 1] + lst[len(lst) - 2]
		lst.append(z)
	print(len(lst) - 2)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	if not a > b:
		(a, b) = (b, a)
	chance = 1
	count = 0
	while 1:
		if chance == 1:
			b += a
			count += 1
			chance = 0
		else:
			a += b
			count += 1
			chance = 1
		if a > n or b > n:
			break
	print(count)


def min_op(a, b, n):
	count = 0
	while a <= n and b <= n:
		n1 = min(a, b)
		n2 = max(a, b)
		n1 += n2
		a = n1
		b = n2
		count += 1
	return count
t = int(input())
for _ in range(t):
	abn = input().split()
	a = int(abn[0])
	b = int(abn[1])
	n = int(abn[2])
	print(min_op(a, b, n))


import math
t = int(input())
for i in range(t):
	c = input()
	c = c.split()
	(a, b, n) = (int(c[0]), int(c[1]), int(c[2]))
	count = 0
	while True:
		if a > n:
			break
		if b > n:
			break
		if a > b:
			b += a
		else:
			a += b
		count += 1
	print(count)


import sys
t = int(input())
for i in range(t):
	(a, b, k) = map(int, input().split())
	c = 0
	d = 0
	a1 = a
	b1 = b
	while a <= k and b <= k:
		if c % 2 == 0:
			a = a + b
		else:
			b = b + a
		c = c + 1
	while a1 <= k and b1 <= k:
		if d % 2 == 1:
			a1 = a1 + b1
		else:
			b1 = b1 + a1
		d = d + 1
	print(min(c, d))


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	j = 0
	if a > n or b > n:
		print(j)
		continue
	else:
		while a <= n:
			j += 1
			num = min(a, b)
			b = max(a, b)
			a = num
			a += b
		print(j)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def solve(t):
	(a, b, n) = t
	steps = 0
	while a <= n and b <= n:
		if a >= b:
			b += a
		else:
			a += b
		steps += 1
	print(steps)
T = inp()
tests = []
for _ in range(T):
	tests.append(inlt())
for t in tests:
	solve(t)


cases = int(input())
for case in range(cases):
	values = input().split()
	(a, b, n) = (int(values[0]), int(values[1]), int(values[2]))
	times = 0
	while a <= n and b <= n:
		if a >= b:
			b += a
		else:
			a += b
		times += 1
	print(times)


T = [int(x) for x in input().split(' ')][0]
for i in range(T):
	(a, b, n) = [int(x) for x in input().split(' ')]
	z = 0
	while max(a, b) <= n:
		z += 1
		if a < b:
			a += b
		else:
			b += a
	print(z)


t = int(input())
while t > 0:
	(a, b, c) = map(int, input().split())
	count = 0
	while c >= a and c >= b:
		count += 1
		if a < b:
			(a, b) = (b, a)
		b += a
	print(count)
	t -= 1


for test in range(0, int(input())):
	(a, b, n) = [int(x) for x in input().split()]
	c = 1
	while a + b <= n:
		if a > b:
			b += a
		else:
			a += b
		c += 1
	print(c)


t = int(input())
for _ in range(0, t):
	(a, b, n) = map(int, input().split())
	(a1, b1, a2, b2, s1, s2) = (0, 0, 0, 0, 0, 0)
	a1 += a
	b1 += b
	a2 += a
	b2 += b
	while a1 <= n and b1 <= n:
		if s1 % 2:
			a1 += b1
		else:
			b1 += a1
		s1 += 1
	while a2 <= n and b2 <= n:
		if not s2 % 2:
			a2 += b2
		else:
			b2 += a2
		s2 += 1
	print(min(s1, s2))


for i in range(int(input())):
	(a, b, c) = map(int, input().split(' '))
	ct = 0
	while a <= c and b <= c:
		(a, b) = (max(a, b), a + b)
		ct += 1
	print(ct)


import sys
import math
from collections import defaultdict

def solve(test):
	(a, b, n) = map(int, input().split())
	ans = 0
	while not (a > n or b > n):
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


import sys
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')

def list_input():
	return list(map(int, input().split()))

def sep_input():
	return map(int, input().split())

def fib(a, b, n):
	l = [a, b]
	l.sort()
	c = 0
	while True:
		if l[-1] > n:
			return c
		l.append(l[-1] + l[-2])
		c += 1
for _ in range(int(input())):
	(a, b, n) = sep_input()
	print(fib(a, b, n))


t = int(input())
while t:
	t -= 1
	(x, y, n) = map(int, input().split())
	res1 = x
	res2 = y
	x = min(res1, res2)
	y = max(res1, res2)
	c = 0
	flag = 0
	while True:
		if flag == 0:
			x = x + y
			c += 1
			flag = 1
			if x > n:
				break
		else:
			y += x
			c += 1
			flag = 0
			if y > n:
				break
	print(c)


t = int(input())
while t:
	(a, b, n) = map(int, input().split())
	a0 = a
	b0 = b
	c1 = 0
	while a <= n and b <= n:
		c1 += 1
		b += a
		(a, b) = (b, a)
	a = b0
	b = a0
	c2 = 0
	while a <= n and b <= n:
		c2 += 1
		b += a
		(a, b) = (b, a)
	print(min(c1, c2))
	t -= 1


__MULTITEST = 1

def solve():
	(a, b, n) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	ans1 = (n - a + 1) // b + (1 if (n - a + 1) % b != 0 else 0)
	ans2 = 0
	turn = 0
	while a <= n and b <= n:
		if a <= n and b <= n:
			if turn == 0:
				a += b
				turn += 1
			else:
				b += a
				turn -= 1
		ans2 += 1
	print(min(ans1, ans2))
t = int(input()) if __MULTITEST else 1
for tt in range(t):
	solve()


def steps(a, b, n):
	step = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		step += 1
	return step
for i in range(int(input())):
	(a, b, n) = [int(elem) for elem in input().split()]
	print(steps(a, b, n))


n = int(input())
for i in range(n):
	x = input().split()
	x = list(map(int, x))
	t = 0
	if x[0] < x[1]:
		(x[0], x[1]) = (x[1], x[0])
	while 1:
		if (x[0] > x[2]) | (x[1] > x[2]):
			break
		if t & 1 == 1:
			x[0] += x[1]
		else:
			x[1] += x[0]
		t += 1
	print(t)


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().split()))
	num = 0
	m = min(a, b)
	M = max(a, b)
	a = m
	b = M
	while a <= n and b <= n:
		s = a + b
		a = b
		b = s
		num += 1
	print(num)


t = int(input())
while t > 0:
	(a, b, n) = input().split()
	a = int(a)
	b = int(b)
	n = int(n)
	x = a
	y = b
	ans1 = 0
	while y <= n:
		x += y
		temp = x
		x = y
		y = temp
		ans1 += 1
	x = a
	y = b
	ans2 = 0
	while x <= n:
		y += x
		temp = x
		x = y
		y = temp
		ans2 += 1
	print(min(ans1, ans2))
	t -= 1


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	cnt = 0
	maxx = max(a, b)
	ans = maxx
	while b <= n and a <= n:
		if max(a, b) == a:
			b = b + a
			cnt = cnt + 1
		elif max(a, b) == b:
			a = a + b
			cnt = cnt + 1
	print(cnt)


import sys
input = sys.stdin.readline
test = int(input())
while test != 0:
	test -= 1
	(a, b, n) = map(int, input().split())
	ans = 0
	while a <= n and b <= n:
		if a > b:
			b += a
		else:
			a += b
		ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	c = max(a, b)
	d = min(a, b)
	ans1 = 0
	ans2 = 0
	while c <= n and d <= n:
		d = c + d
		(c, d) = (d, c)
		ans1 = ans1 + 1
	c = max(a, b)
	d = min(a, b)
	while c <= n and d <= n:
		c = c + d
		(c, d) = (d, c)
		ans2 = ans2 + 1
	print(min(ans1, ans2))


import sys
t = int(sys.stdin.readline())
for i in range(t):
	(a, b, n) = map(int, sys.stdin.readline().split())
	count = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		count += 1
	print(count)


a = int(input())
for i in range(a):
	(x, y, n) = map(int, input().split())
	(x, y) = (min(x, y), max(x, y))
	ans = [x, y]
	while ans[-1] <= n:
		ans.append(ans[-1] + ans[-2])
	print(len(ans) - 2)


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	a = l[0]
	b = l[1]
	n = l[2]
	c = 0
	while not (a > n or b > n):
		if a > b:
			b = a + b
		else:
			a = a + b
		c += 1
	print(c)


for t in range(int(input())):
	(a, b, n) = map(int, input().split())
	s = 0
	c = 0
	if b > a:
		temp = a
		a = b
		b = temp
	if a > n:
		print(0)
	else:
		c = 1
		s = a + b
		while s <= n:
			x = s
			s += a
			a = x
			c += 1
		print(c)


t = int(input())
for i in range(t):
	(a, b, n) = map(int, input().split())
	if a < b:
		c = a
		a = b
		b = c
	k = 1
	while k > 0:
		m = k - k // 2 * 2
		if m != 0:
			b += a
			k = k + 1
		else:
			a += b
			k = k + 1
		if a > n or b > n:
			break
	print(k - 1)


t = int(input())
for _ in range(t):
	(a, b, n) = list(map(int, input().strip().split()))
	if a <= b:
		small = a
		big = b
	else:
		small = b
		big = a
	steps = 0
	while big <= n:
		small += big
		steps += 1
		(small, big) = (big, small)
	print(steps)


num = int(input())
for i in range(0, num):
	(a, b, c) = map(int, input().split())
	if a > b:
		var = a
		test = b
	else:
		var = b
		test = a
	ans = 0
	tmp = 0
	while c >= tmp:
		test += var
		ans += 1
		tmp = test
		test = var
		var = tmp
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	(a, b, n) = input().split()
	(a, b, n) = (int(a), int(b), int(n))
	ans = 0
	while max(a, b) <= n:
		if a < b:
			a += b
		else:
			b += a
		ans += 1
	print(ans)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	c = 0
	ma = max(a, b)
	mi = min(a, b)
	i = 0
	while ma < n and mi < n:
		if i % 2 == 1:
			ma += mi
		else:
			mi += ma
		c += 1
		i += 1
	if ma > n or mi > n:
		print(c)
	else:
		print(c + 1)


t = int(input())
for _ in range(t):
	(a, b, n) = map(int, input().split())
	if a > n or b > n:
		print(0)
		continue
	count = 0
	while True:
		if a > n or b > n:
			break
		if a <= b:
			a += b
		else:
			b += a
		count += 1
	print(count)


t = int(input())
while t != 0:
	t = t - 1
	(a, b, n) = map(int, input().strip().split(' '))
	d = 0
	c = 0
	if a > b:
		i = a
		a = b
		b = i
	while a <= n and b <= n:
		a = a + b
		c += 1
		if a < n:
			b += a
			c += 1
	print(c)


cases = int(input())
for _ in range(cases):
	(a, b, n) = [int(x) for x in input().split()]
	operations = 0
	while not (a > n or b > n):
		if a > b:
			b += a
		else:
			a += b
		operations += 1
	print(operations)


def getFibOpNum(a, b, n):
	count = 0
	s = 0
	while s <= n:
		s = a + b
		count += 1
		a = b
		b = s
	return count
t = int(input())
for _ in range(t):
	(a, b, n) = [int(x) for x in input().split()]
	if a > b:
		temp = a
		a = b
		b = temp
	print(getFibOpNum(a, b, n))


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	s = list(sorted([a, b]))
	steps = 1
	s.append(a + b)
	while s[-1] <= n:
		s.append(s[-1] + s[-2])
		steps += 1
	print(steps)


for _ in range(int(input())):
	(a, b, n) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	s = b
	ans = 0
	if s > n:
		ans = 0
	else:
		s = a + b
		cnt = 1
		while s <= n:
			a = b
			b = s
			s = a + b
			cnt += 1
		ans = cnt
	print(ans)


def main():
	t = int(input())
	allAns = []
	for _ in range(t):
		(a, b, n) = readIntArr()
		ans = 0
		while True:
			if a > n or b > n:
				break
			if a < b:
				a += b
			else:
				b += a
			ans += 1
		allAns.append(ans)
	multiLineArrayPrint(allAns)
	return
import sys
input = sys.stdin.buffer.readline

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]
inf = float('inf')
MOD = 10 ** 9 + 7
main()


t = eval(input())
for _ in range(t):
	(a, b, n) = [int(i) for i in input().split(' ')]
	step = 0
	while max(a, b) <= n:
		(a, b) = (min(a, b), max(a, b))
		a += b
		step += 1
	print(step)


t = int(input())
while t:
	(a, b, n) = input().split()
	n = int(n)
	a = int(a)
	b = int(b)
	i = 0
	while a <= n or b <= n:
		if a > b:
			b += a
		else:
			a += b
		i += 1
	print(i - 1)
	t -= 1


t = int(input())
for r in range(t):
	(a, b, n) = list(map(int, input().split()))
	c = 0
	e = 0
	if b > a:
		(a, b) = (b, a)
	for i in range(n):
		if i % 2 == 0:
			b += a
			c += 1
		else:
			a += b
			c += 1
		if a > n or b > n:
			break
	print(c)


from sys import *
t = int(input())
for i in range(t):
	c = list(map(int, input().strip().split()))[:3]
	(a, b, n) = (c[0], c[1], c[2])
	x = 0
	if a > b:
		x = a
		a = b
		b = x
	(c0, c1, c2) = (0, a, a)
	(d0, d1, d2) = (0, b, 2 * b)
	j = 2
	if a + b > n:
		print(1)
	else:
		while c2 + d2 <= n:
			c0 = c1 + c2
			c1 = c2
			c2 = c0
			d0 = d1 + d2
			d1 = d2
			d2 = d0
			j = j + 1
		print(j)


t = int(input())
l = [0] * 110
for i in range(t):
	(a, b, n) = map(int, input().split())
	s = 0
	k = []
	if a > b:
		s = a
		a = b
		b = s
	k.append(a)
	k.append(b)
	while k[len(k) - 1] <= n:
		k.append(k[len(k) - 1] + k[len(k) - 2])
		l[i] += 1
for j in range(t):
	print(l[j])


def f():
	return map(int, input().split())

def lis():
	return list(map(int, input().split()))
t = int(input())
for _ in range(t):
	(a, b, n) = f()
	ans = 0
	while 1 == 1:
		if b > n or a > n:
			break
		if b < a:
			b += a
			ans += 1
		else:
			a += b
			ans += 1
	print(ans)


for t in range(int(input())):
	(a, b, n) = map(int, input().split())
	flag = 0
	c = 0
	(b, a) = (max(a, b), min(a, b))
	while a <= n and b <= n:
		temp = a + b
		a = b
		b = temp
		c += 1
	print(c)


from math import ceil
x = int(input())
for i in range(x):
	a = list(map(int, input().split()))
	count = 0
	while a[2] >= a[0] and a[2] >= a[1]:
		if a[0] <= a[1]:
			a[0] = a[0] + a[1]
		else:
			a[1] = a[0] + a[1]
		count = count + 1
	print(count)