T = int(input())
def sol(sen):
a,b,n = map(int,sen.split())
count = 0
while a <= n and b<=n:
if a <= b: #10 17
a += b
elif b < a:
b += a
count += 1
return count
for test_case in range(1, T + 1):
print(sol(input()))
T = int(input())
def solution(n,l): #10 7 6, 0 / 3 5 9, 10
n = list(map(int,n.split()))
buy = 0 ; answer = 0
while len(n) != 0:
p = n.index(max(n))
for i in range(p+1):
if i == p:
answer += buy*n[p]
buy = 0
else:
answer -= n[i]
buy += 1
n = n[p+1:]
return answer
for test_case in range(1, T + 1):
l = int(input())
print(f"#{test_case} {solution(input(),l)}")
T = int(input())
def sol(n):
l = [str(i+1) for i in range(n)]
for i in range(len(l)):
l[i] = l[i].replace('3','-')
l[i] = l[i].replace('6','-')
l[i] = l[i].replace('9','-')
if '-' in l[i]:
c = l[i].count('-')
l[i] = '-'*c
ls = ' '.join(l)
return ls
print(sol(T))