def check(h,c,x,t):
    return abs((x*(h+c-2*t)+t-c)/(2*x-1))

def answer(h,c,t):
    avg=(h+c)//2
    if t<=avg:
        return 2
    x=(t-c)//(2*t-h-c)
    if check(h,c,x,t)<=check(h,c,x+1,t):
        return 2*x-1
    else:
        return 2*x+1
t=int(input())
for i in range(t):
    h,c,t=map(int,input().split())
    print(answer(h,c,t))


from math import ceil,floor
T = int(input())
def func(m,h,c,t):
    return abs(((m+1)*h+m*c)/(2*m+1)-t)
for _ in range(T):
    h,c,t = map(int,input().split())
    if 2*t <= (h+c):
        print(2)
    else:
        if t == h:
            print(1)
        else:
            x = (h-t)/(2*t-h-c)
            mf = floor(x)
            mc = ceil(x)
            if func(mf,h,c,t) <= func(mc,h,c,t):
                print(2*mf +1)
            else:
                print(2*mc +1)


from math import floor, ceil
tests = int(input())
for _ in range(tests):
    h,c,t = map(int,input().split())
    if 2*t <= h + c:
        print(2)
    else:
        m = (h-t)/(2*t-h-c)
        if m == 0:
            print(1)
        else:
            m1 = ceil(m)
            m2 = floor(m)
            if abs(((m2+1)*h+m2*c)/(2*m2+1)-t) <= abs(((m1+1)*h+m1*c)/(2*m1+1)-t):
                print(2*m2+1)
            else:
                print(2*m1+1)


from math import floor, ceil
tests = int(input())
for _ in range(tests):
    h,c,t = map(int,input().split())
    if 2*t <= h + c:
        print(2)
    else:
        m = (h-t)/(2*t-h-c)
        if m == 0:
            print(1)
        else:
            m1 = ceil(m)
            m2 = floor(m)
            if abs(((m2+1)*h+m2*c)-(2*m2+1)*t) < abs(((m1+1)*h+m1*c)-(2*m1+1)*t):
                print(2*m2+1)
            else:
                print(2*m1+1)


from math import ceil,floor
t = int(input())
def func(m,h,c,t):
    return abs(((m+1)*h+m*c)/(2*m+1)-t)
for _ in range(t):
    h,c,t = map(float,input().split())
    if t <= (h+c)/2:
        if t == h:
            print(1)
        else:
            print(2)
    else:
        x = (h-t)/(2*t-h-c)
        mf = floor(x)
        mc = ceil(x)
        if func(mf,h,c,t) <= func(mc,h,c,t):
            print(2*mf+1)
        else:
            print(2*mc+1)


from math import floor, ceil
tests = int(input())
for _ in range(tests):
    h,c,t = map(int,input().split())
    if 2*t <= h + c:
        print(2)
    else:
        m = (h-t)/(2*t-h-c)
        if m == 0:
            print(1)
        else:
            m1 = ceil(m)
            m2 = floor(m)
            if abs(((m2+1)*h+m2*c)-(2*m2+1)*t) < abs(((m1+1)*h+m1*c)-(2*m1+1)*t):
                if m1 > 1:
                    print(2*m2+1)
                else:
                    print(2*m1+1)
            else:
                print(2*m1+1)


from math import floor, ceil
tests = int(input())
for _ in range(tests):
    h,c,t = map(int,input().split())
    if 2*t <= h + c:
        print(2)
    else:
        m = (h-t)/(2*t-h-c)
        if m == 0:
            print(1)
        else:
            m1 = ceil(m)
            m2 = floor(m)
            if abs(((m2+1)*h+m2*c)/(2*m2+1)-t) <= abs(((m1+1)*h+m1*c)/(2*m1+1)-t):
                print(m2)
            else:
                print(m1)


from math import ceil,floor
t = int(input())
def func(m,h,c,t):
    return abs(((m+1)*h+m*c)/(2*m+1)-t)
for _ in range(t):
    h,c,t = map(float,input().split())
    if t <= (h+c)/2:
        print(2)
    else:
        x = (h-t)/(2*t-h-c)
        mf = floor(x)
        mc = ceil(x)
        if func(mf,h,c,t) <= func(mc,h,c,t):
            print(2*mf+1)
        else:
            print(2*mc+1)


from math import floor, ceil
tests = int(input())
for _ in range(tests):
    h,c,t = map(int,input().split())
    if 2*t <= h + c:
        print(2)
    else:
        m = (h-t)/(2*t-h-c)
        if m == 0:
            print(1)
        else:
            m1 = ceil(m)
            m2 = floor(m)
            if abs(((m2+1)*h+m2*c)-(2*m2+1)*t) < abs(((m1+1)*h+m1*c)-(2*m1+1)*t):
                if abs(((m2+1)*h+m2*c)/(2*m2+1)-t) <= abs(((m1+1)*h+m1*c)/(2*m1+1)-t):
                    print(2*m2+1)
                else:
                    print(2*m1+1)
            else:
                print(2*m1+1)


from sys import stdin
from collections import Counter, deque
from bisect import bisect_left
input = stdin.buffer.readline

T = int(input())
for _ in range(T):
    h, c, t = map(int, input().split())
    m = (h+c)/2; d = h-m
    if t == m: print(2); continue

    can = [(abs(m-t), 2)]
    x = int(d/(t-m))
    for u in (x-2, x-1, x, x+1, x+2):
        if u % 2 and u > 0: can.append((abs(m+d/u-t), u))
    can.sort()
    print(can[0][1])


from sys import stdin
from collections import Counter, deque
from bisect import bisect_left
input = stdin.buffer.readline

T = int(input())
for _ in range(T):
    h, c, t = map(int, input().split())
    m = (h+c)/2; d = h-m
    if t == m: print(2); continue

    can = [(abs(m-t), 2), (abs(h-t), 1)]
    x = int(d/(t-m))
    for u in (x-3, x-2, x-1, x, x+1, x+2, x+3):
        if u % 2 and u > 1: can.append((abs(m+d/u-t), u))
    can.sort()
    print(can[0][1])


from sys import stdin
from collections import Counter, deque
from bisect import bisect_left
input = stdin.buffer.readline

T = int(input())
for _ in range(T):
    h, c, t = map(int, input().split())
    m = (h+c)/2; d = h-m
    if t == m: print(2); continue

    can = [(abs(m-t), 2)]
    x = int(d/(t-m))
    for u in (x-1, x, x+1):
        if u % 2: can.append((abs(m+d/u-t), u))
    can.sort()
    print(can[0][1])


from sys import stdin
from collections import Counter, deque
from bisect import bisect_left
input = stdin.buffer.readline

T = int(input())
for _ in range(T):
    h, c, t = map(int, input().split())
    if t*2 <= h+c: print(2); continue
    a = int((t-h)/(h-2*t+c))
    b = a+1
    tt = t*(2*a+1)*(2*b+1)
    aa = abs(tt-(a*(c+h)+h)*(2*b+1))
    bb = abs(tt-(b*(c+h)+h)*(2*a+1))
    print(2*a+1 if aa <= bb else 2*b+1)


from sys import stdin
from collections import Counter, deque
from bisect import bisect_left
input = stdin.buffer.readline

T = int(input())
for _ in range(T):
    h, c, t = map(int, input().split())
    m = (h+c)/2; d = h-m
    if t == m: print(2); continue

    can = [(abs(m-t), 2)]
    x = int(d/(t-m))
    for u in (x-2, x-1, x, x+1, x+2):
        if u % 2 and u > 0: can.append((abs(m+d/u-t), u))
    can.sort()
    print(can, can[0][1])


from sys import stdin
from collections import Counter, deque
from bisect import bisect_left
input = stdin.buffer.readline

T = int(input())
for _ in range(T):
    h, c, t = map(int, input().split())
    m = (h+c)/2; d = h-m
    if t == m: print(2); continue

    can = [(abs(m-t), 2), (abs(h-t), 1)]
    x = int(d/(t-m))
    for u in (x-3, x-2, x-1, x, x+1, x+2, x+3):
        if u % 2 and u > 1: can.append((abs(m+d/u-t), u))
    can.sort()
    print(x, can, can[0][1])


from sys import stdin
from collections import Counter, deque
from bisect import bisect_left
input = stdin.buffer.readline

T = int(input())
for _ in range(T):
    h, c, t = map(int, input().split())
    m = (h+c)/2; d = h-m
    if t == m: print(2); continue

    can = [(abs(m-t), 2)]
    x = int(d/(t-m))
    for u in (x-3, x-2, x-1, x, x+1, x+2, x+3):
        if u % 2 and u > 0: can.append((abs(m+d/u-t), u))
    can.sort()
    print(can[0][1])


from sys import stdin
from collections import Counter, deque
from bisect import bisect_left
input = stdin.buffer.readline

T = int(input())
for _ in range(T):
    h, c, t = map(int, input().split())
    m = (h+c)/2; d = h-m
    if t == m: print(2); continue

    can = [(abs(m-t), 2)]
    x = int(d/(t-m))
    for u in (x-1, x, x+1):
        if u % 2 and u > 0: can.append((abs(m+d/u-t), u))
    can.sort()
    print(can[0][1])


from fractions import Fraction
import sys
input = sys.stdin.readline

t=int(input())
g= [list(map(Fraction,input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = -1
        r = pow(10, 12)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if Fraction((c*mid+h*(mid+1))/v)<x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める

        if Fraction(abs(x-(c*r+h*(r+1))/(r*2+1)))<Fraction(abs(x-(c*(r-1)+h*r)/(r*2-1))):
            ans[i]=r*2+1
        else:
            ans[i]=r*2-1

for i in range(t):
    print(ans[i])


import sys
input = lambda: sys.stdin.readline().rstrip()

t=int(input())
g= [list(map(int, input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = 0
        r = pow(10, 20)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if (c*mid+h*(mid+1))/v<=x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める
        v=r*2+1
        w=r*2-1
        if abs(x-(c*r+h*(r+1))/v)<abs(x-(c*(r-1)+h*r)/w):
            ans[i]=v
        else:
            ans[i]=w

for i in range(t):
    print(ans[i])


import sys
input = lambda: sys.stdin.readline().rstrip()

t=int(input())
g= [list(map(int, input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = 0
        r = pow(10, 30)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if (c*mid+h*(mid+1))/v<=x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める
        v=r*2+1
        w=r*2-1
        if abs(x-(c*r+h*(r+1))/v)<abs(x-(c*(r-1)+h*r)/w):
            ans[i]=v
        else:
            ans[i]=w

for i in range(t):
    print(ans[i])


from fractions import Fraction

t=int(input())
g= [list(map(Fraction,input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = -1
        r = pow(10, 20)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if Fraction((c*mid+h*(mid+1))/v)<x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める

        if Fraction(abs(x-(c*r+h*(r+1))/(r*2+1)))<Fraction(abs(x-(c*(r-1)+h*r)/(r*2-1))):
            ans[i]=r*2+1
        else:
            ans[i]=r*2-1

for i in range(t):
    print(ans[i])


import sys
input = lambda: sys.stdin.readline().rstrip()

t=int(input())
g= [list(map(int, input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = -1
        r = pow(10, 10)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*r+1
            if (c*v//2+h*(v//2+1))/v<=x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める
        v=r*2+1
        w=r*2-1
        if x-(c*v//2+h*(v//2+1))/v<abs(w-(c*v//2+h*(v//2+1))/v):
            ans[i]=v
        else:
            ans[i]=w

for i in range(t):
    print(ans[i])


import sys
input = lambda: sys.stdin.readline().rstrip()

t=int(input())
g= [list(map(int, input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = -1
        r = pow(10, 30)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if (c*mid+h*(mid+1))/v<=x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める
        v=r*2+1
        w=r*2-1
        if abs(x-(c*r+h*(r+1))/v)<abs(x-(c*(r-1)+h*r)/w):
            ans[i]=v
        else:
            ans[i]=w

for i in range(t):
    print(ans[i])


from fractions import Fraction
import sys
input = sys.stdin.readline

t=int(input())
g= [list(map(Fraction,input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = -1
        r = pow(10, 15)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if Fraction((c*mid+h*(mid+1))/v)<x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める

        if Fraction(abs(x-(c*r+h*(r+1))/(r*2+1)))<Fraction(abs(x-(c*(r-1)+h*r)/(r*2-1))):
            ans[i]=r*2+1
        else:
            ans[i]=r*2-1

for i in range(t):
    print(ans[i])


import sys
input = lambda: sys.stdin.readline().rstrip()

t=int(input())
g= [list(map(int, input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = 0
        r = pow(10, 10)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if (c*mid+h*(mid+1))/v<x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める
        v=r*2+1
        w=r*2-1
        if abs(x-(c*v//2+h*(v//2+1))/v)<abs(x-(c*w//2+h*(w//2+1))/w):
            ans[i]=v
        else:
            ans[i]=w

for i in range(t):
    print(ans[i])


t=int(input())
g= [list(map(int, input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = -1
        r = pow(10, 20)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if (c*mid+h*(mid+1))/v<=x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める

        if abs(x-(c*r+h*(r+1))/(r*2+1))<abs(x-(c*(r-1)+h*r)/(r*2-1)):
            ans[i]=r*2+1
        else:
            ans[i]=r*2-1

for i in range(t):
    print(ans[i])


import sys
input = lambda: sys.stdin.readline().rstrip()

t=int(input())
g= [list(map(int, input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = -1
        r = pow(10, 10)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if (c*mid+h*(mid+1))/v<x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める
        v=r*2+1
        w=r*2-1
        if abs(x-(c*v//2+h*(v//2+1))/v)<abs(x-(c*w//2+h*(w//2+1))/w):
            ans[i]=v
        else:
            ans[i]=w

for i in range(t):
    print(ans[i])


t=int(input())
g= [list(map(int, input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = -1
        r = pow(10, 20)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if (c*mid+h*(mid+1))/v<x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める

        if abs(x-(c*r+h*(r+1))/(r*2+1))<abs(x-(c*(r-1)+h*r)/(r*2-1)):
            ans[i]=r*2+1
        else:
            ans[i]=r*2-1

for i in range(t):
    print(ans[i])


from fractions import Fraction
import sys
input = sys.stdin.readline

t=int(input())
g= [list(map(Fraction,input().split())) for i in range(t)]
ans=[0]*t
for i in range(t):
    h=g[i][0]
    c=g[i][1]
    x=g[i][2]
    if x>=h:
        ans[i]=1
    elif x<=(h+c)/2:
        ans[i]=2
    else:
        l = -1
        r = pow(10, 8)
        while r - l > 1:
            # rは常にOK、lは常にNG。
            mid = l + (r - l) // 2
            # なんらかの判定
            v=2*mid+1
            if Fraction((c*mid+h*(mid+1))/v)<x:
                r = mid  # 判定がOKのとき→範囲を左に狭める
            else:
                l = mid  # 判定がNGのとき→範囲を右に狭める

        if Fraction(abs(x-(c*r+h*(r+1))/(r*2+1)))<Fraction(abs(x-(c*(r-1)+h*r)/(r*2-1))):
            ans[i]=r*2+1
        else:
            ans[i]=r*2-1

for i in range(t):
    print(ans[i])


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    if t<=(h+c)/2:
        print(2)
        continue
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)+h)/(m*2+1)
    m=(t-h)/(c+h-2*t)
    l = int(m)
    r = l+1
    ansl = (abs(t-f(l)),2*l+1)
    ansr =  (abs(t-f(r)),r*2+1)
    # print(ansl,ansr)
    print(min(ansl,ansr)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 0
    r = 10000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)-c)/(m*2-1)
    while r-l>1:
        m = (r+l)//2
        x = f(m)
        if x>=t:
            l = m
        else:
            r = m
    ansm = (abs(t-(h+c)//2),2)
    ansl = (abs(t-f(l)),2*l-1)
    ansr =  (abs(t-f(r)),r*2-1)
    print(min(ansl,ansr,ansm)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)-c)/(m*2-1)
    while r-l>1:
        m = (r+l)//2
        x = f(m)
        if x>=t:
            l = m
        else:
            r = m
    ansm = (abs(t-(h+c)//2),2)
    ansl = (abs(t-f(l)),2*l-1)
    ansr =  (abs(t-f(r)),r*2-1)
    ansz = (abs(t-h),1)
    # print(ansl,ansr,ansm,ansz)
    print(min(ansl,ansr,ansm,ansz)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    if t<=(h+c)/2:
        print(2)
        continue
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)-c)/(m*2-1)
    m=(c-t)/(c+h-2*t)
    l = max(2,int(m))
    r = l+1
    a= l-1
    ansa = (abs(t-f(a)),2*a-1)
    ansl = (abs(t-f(l)),2*l-1)
    ansr =  (abs(t-f(r)),r*2-1)
    # print(ansl,ansr,ansm,ansz)
    print(min(ansl,ansr,ansa)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)-c)/(m*2-1)
    while r-l>1:
        m = (r+l)//2
        x = f(m)
        if x>=t:
            l = m
        else:
            r = m
    ansm = (abs(t-(h+c)/2),2)
    ansl = (abs(t-f(l)),2*l-1)
    ansr =  (abs(t-f(r)),r*2-1)
    ansz = (abs(t-h),1)
    # print(ansl,ansr,ansm,ansz)
    print(min(ansl,ansr,ansm,ansz)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    if t<=(h+c)/2:
        print(2)
        continue
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return m*(h+c)+h
    l=(t-h)//(c+h-2*t)
    r = l+1
    ansl = (abs(t*(2*l+1)-f(l))*(r*2+1),2*l+1)
    ansr =  (abs(t*(r*2+1)-f(r))*(2*l+1),r*2+1)
    # print(ansl,ansr)
    print(min(ansl,ansr)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    if t<=(h+c)/2:
        print(2)
        continue
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)-c)/(m*2-1)
    m=(c-t)/(c+h-2*t)
    l = int(m)
    r = l+1
    ansl = (abs(t-f(l)),2*l-1)
    ansr =  (abs(t-f(r)),r*2-1)
    # print(ansl,ansr,ansm,ansz)
    print(min(ansl,ansr)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 10000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)-c)/(m*2-1)
    while r-l>1:
        m = (r+l)//2
        x = f(m)
        if x>t:
            l = m
        else:
            r = m
    ansm = (abs(t-(h+c)/2),2)
    ansl = (abs(t-f(l)),2*l-1)
    ansr =  (abs(t-f(r)),r*2-1)
    ansz = (abs(t-h),1)
    # print(ansl,ansr,ansm,ansz)
    print(min(ansl,ansr,ansm,ansz)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 0
    r = 1000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)+c)/(m*2+1)
    while r-l>1:
        m = (r+l)//2
        x = f(m)
        if x>=t:
            l = m
        else:
            r = m
    ansm = (abs(t-(h+c)/2),2)
    ansl = (abs(t-f(l)),2*l+1)
    ansr =  (abs(t-f(r)),r*2+1)
    ansz = (abs(t-h),1)
    # print(ansl,ansr,ansm,ansz)
    print(min(ansl,ansr,ansm,ansz)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    if t<=(h+c)/2:
        print(2)
        continue
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)-c)/(m*2-1)
    m=(t-h)/(c+h-2*t)
    l = max(2,int(m))
    r = l+1
    a= l-1
    ansa = (abs(t-f(a)),2*a-1)
    ansl = (abs(t-f(l)),2*l-1)
    ansr =  (abs(t-f(r)),r*2-1)
    print(ansl,ansr,ansa)
    print(min(ansl,ansr,ansa)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    if t<=(h+c)/2:
        print(2)
        continue
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return m*(h+c)+h
    l=(t-h)//(c+h-2*t)
    r = l+1
    ansl = (abs(t*(2*l+1)-f(l)*(r*2+1)),2*l+1)
    ansr =  (abs(t*(r*2+1)-f(r))*(2*l+1),r*2+1)
    # print(ansl,ansr)
    print(min(ansl,ansr)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)-c)/(m*2-1)
    while r-l>1:
        m = (r+l)//2
        x = f(m)
        if x>t:
            l = m
        else:
            r = m
    ansm = (abs(t-(h+c)/2),2)
    ansl = (abs(t-f(l)),2*l-1)
    ansr =  (abs(t-f(r)),r*2-1)
    ansz = (abs(t-h),1)
    # print(ansl,ansr,ansm,ansz)
    print(min(ansl,ansr,ansm,ansz)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    if t<=(h+c)/2:
        print(2)
        continue
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)+h)
    m=(t-h)/(c+h-2*t)
    l = int(m)
    r = l+1
    ansl = (abs(t*(2*l+1)-f(l)),2*l+1)
    ansr =  (abs(t*(r*2+1)-f(r)),r*2+1)
    # print(ansl,ansr)
    print(min(ansl,ansr)[1])
    # a = list(map(int,input().split()))
    # s = list(input())


import sys
# import math
# from collections import deque
# import heapq
# from math import inf
# from math import gcd

# print(help(deque))
# 26
pprint = lambda s: print(' '.join(map(str, s)))
input = lambda: sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
    # n = int(input())
    h,c,t= map(int,input().split())
    if t<=(h+c)/2:
        print(2)
        continue
    # if t == h:
    #     print(1)
    #     continue
    # if t==(h+c)//2:
    #     print(2)
    #     continue
    l = 1
    r = 1000000000000000000
    # for m in range(20):
    #     m+=1
    #     print((m*(h+c)-c)/(m*2-1))
    # print("?????????")
    def f(m):
        return (m*(h+c)-c)/(m*2-1)
    m=(c-t)/(c+h-2*t)
    l = max(2,int(m))
    r = l+1
    a= l-1
    ansa = (abs(t-f(a)),2*a-1)
    ansl = (abs(t-f(l)),2*l-1)
    ansr =  (abs(t-f(r)),r*2-1)
    # print(ansl,ansr,ansm,ansz)
    print(min(ansl,ansr,ansa)[1] )
    # a = list(map(int,input().split()))
    # s = list(input())


tests=int(input())
for _ in range(tests):
    h,c,t=map(int,input().split())
    av1=(h+c)/2
    if (h+c)/2 == t:
        print(2)
    else:
        x=(t-h)/(h+c-2*t)

        if x<0:
            if abs(h-t)<=abs(t-av1):
                print(1)
                continue
            else:
                print(2)
                continue
        x=int(x)

        av2=((x+1)*h+x*c)/(2*x+1)
        av3=((x+2)*h+(x+1)*c)/(2*(x+1)+1)

        if abs(av3-t)<abs(av2 -t):
            x=x+1
            av2=av3

        if abs(t-av1) > abs(t-av2):
            print(2*x+1)
        elif abs(t-av1) == abs(t-av2):
            print(min(2,2*x+1))
        else:

            print(2)


tests=int(input())
for _ in range(tests):
    h,c,t=map(int,input().split())
    av1=(h+c)//2
    if h== t:
        print(1)
    elif (h+c)//2 == t:
        print(2)
    else:
        x=(t-h)/(h+c-2*t)
        if int(x)+0.5 < x:
            x=int(x)+1
        else:
            x= int(x)
        av2=((x+1)*h+x*c)//(2*x+1)
        if abs(t-av1) > abs(t-av2):
            print(2*x+1)
        elif abs(t-av1) == abs(t-av2) and x==0:
            print(1)
        else:
            print(2)


tests=int(input())
for _ in range(tests):
    h,c,t=map(int,input().split())
    av1=(h+c)/2
    if (h+c)/2 == t:
        print(2)
    else:
        x=(t-h)/(h+c-2*t)

        if x<0:
            if abs(h-t)<=abs(t-av1):
                print(1)
                continue
            else:
                print(2)
                continue
        if int(x)+0.5 <= x:
            x=x+1

        x=int(x)

        av2=((x+1)*h+x*c)/(2*x+1)

        if abs(t-av1) > abs(t-av2):
            print(2*x+1)
        elif abs(t-av1) == abs(t-av2):
            print(min(2,2*x+1))
        else:

            print(2)


tests=int(input())
for _ in range(tests):
    h,c,t=map(int,input().split())
    av1=(h+c)/2
    if (h+c)/2 == t:
        print(2)
    else:
        x=(t-h)//(h+c-2*t)

        av2=((x+1)*h+x*c)/(2*x+1)
        av3=((x+2)*h+(x+1)*c)/(2*(x+1)+1)

        if abs(av3-t)<abs(av2 -t):
            x=x+1
            av2=av3

        if abs(t-av1) > abs(t-av2):
            print(2*x+1)
        elif abs(t-av1) == abs(t-av2):
            print(min(2,2*x+1))
        else:

            print(2)


tests=int(input())
for _ in range(tests):
    h,c,t=map(int,input().split())
    av1=(h+c)/2
    if (h+c)/2 == t:
        print(2)
    else:
        x=(t-h)/(h+c-2*t)

        if x<0:
            if abs(h-t)>=abs(t-av1):
                print(1)
                continue
            else:
                print(2)
                continue
        x=int(x)

        av2=((x+1)*h+x*c)/(2*x+1)
        av3=((x+2)*h+(x+1)*c)/(2*(x+1)+1)

        if abs(av3-t)<abs(av2 -t):
            x=x+1
            av2=av3

        if abs(t-av1) > abs(t-av2):
            print(2*x+1)
        elif abs(t-av1) == abs(t-av2):
            print(min(2,2*x+1))
        else:

            print(2)


tests=int(input())
for _ in range(tests):
    h,c,t=map(int,input().split())
    av1=(h+c)/2
    if (h+c)/2 == t:
        print(2)
    else:
        x=(t-h)//(h+c-2*t)

        av2=((x+1)*h+x*c)/(2*x+1)
        av3=((x+2)*h+(x+1)*c)/(2*(x+1)+1)

        if abs(av3-t)<abs(av2 -t):
            x=x+1
            av2=av3

        if abs(t-av1) > abs(t-av2):
            print(2*x+1)
        else:
            print(2)


import fractions
f=fractions.Fraction
tests=int(input())
for _ in range(tests):
    h,c,t=map(int,input().split())
    av1=(h+c)/2
    if (h+c)/2 == t:
        print(2)
    else:
        x=(t-h)/(h+c-2*t)

        if x<0:
            if abs(h-t)<=abs(t-av1):
                print(1)
                continue
            else:
                print(2)
                continue

        x=int(x)

        av2=f((x+1)*h+x*c,(2*x+1))
        av3=f(((x+2)*h+(x+1)*c),(2*(x+1)+1))
        if abs(av3-t)<abs(av2 -t):
            x=x+1
            av2=av3

        if abs(t-av1) > abs(t-av2):
            print(2*x+1)
        elif abs(t-av1) == abs(t-av2):
            print(min(2,2*x+1))
        else:

            print(2)


tests=int(input())
for _ in range(tests):
    h,c,t=map(int,input().split())
    av1=(h+c)/2
    if h== t:
        print(1)
    elif (h+c)//2 == t:
        print(2)
    else:
        x=(t-h)//(h+c-2*t)

        av2=((x+1)*h+x*c)/(2*x+1)
        av3=((x+2)*h+(x+1)*c)/(2*(x+1)+1)

        if abs(av3-t)<abs(av2 -t):
            x=x+1
            av2=av3

        if abs(t-av1) > abs(t-av2):
            print(2*x+1)
        elif abs(t-av1) == abs(t-av2) and x==0:
            print(1)
        else:
            print(2)


tests=int(input())
for _ in range(tests):
    h,c,t=map(int,input().split())
    av1=(h+c)/2
    if (h+c)/2 == t:
        print(2)
    else:
        x=(t-h)//(h+c-2*t)

        if x<0:
            if abs(h-t)>=abs(t-av1):
                print(1)
                continue
            else:
                print(2)
                continue

        av2=((x+1)*h+x*c)/(2*x+1)
        av3=((x+2)*h+(x+1)*c)/(2*(x+1)+1)

        if abs(av3-t)<abs(av2 -t):
            x=x+1
            av2=av3

        if abs(t-av1) > abs(t-av2):
            print(2*x+1)
        elif abs(t-av1) == abs(t-av2):
            print(min(2,2*x+1))
        else:

            print(2)


import math
import sys
input = sys.stdin.readline
mod = 998244353
n, k = map(int, input().split())
fac = [0] * (n + 1)
inv = [0] * (n + 1)
inv[0] = fac[0] = 1
for i in range(1, n + 1):
	fac[i] = (fac[i - 1] * i) % mod
	inv[i] = pow(fac[i], mod - 2, mod)
def nCr(n, r):
	if n < 0 or n < r:
		return 0
	return (fac[n] * inv[r] * inv[n - r]) % mod
ans = 0
for i in range(1, n + 1):
	ans += nCr((n // i) - 1, k - 1)
	ans %= mod
print(ans)


import math
import sys
input = sys.stdin.readline
ts = int(input())

# (h + c) * n / 2n = (h + c) / 2
# ((h + c) * n + h) / (2n + 1) = (h + c) * n/(2n + 1) + h/(2n + 1)

res = []
for cs in range(ts):
	h, c, t = map(int, input().split())
	l, r = 0, int(1e11)
	while l < r:
		mid = (l + r) // 2
		if (h + c) * mid + h < t * (mid + mid + 1):
			r = mid
		else:
			l = mid + 1
	opt = l
	init = abs(t - (h + c) / 2)
	ans = 2
	for i in range(opt - 2, opt + 3):
		if i < 0:
			continue
		dist = abs(t - (((h + c) * i + h) / (i + i + 1)))
		if dist < init:
			init = dist
			ans = 2 * i + 1
	res.append(ans)

print('\n'.join(map(str, res)))


import math
import sys
from fractions import Fraction
input = sys.stdin.readline
ts = int(input())

# (h + c) * n / 2n = (h + c) / 2
# ((h + c) * n + h) / (2n + 1) = (h + c) * n/(2n + 1) + h/(2n + 1)

res = []
for cs in range(ts):
	h, c, t = map(int, input().split())
	if 2 * t <= (h + c):
		res.append(2)
	else:
		l, r = 0, int(1e9)
		while l < r:
			mid = (l + r) // 2
			if (h + c) * mid + h <= t * (mid + mid + 1):
				r = mid
			else:
				l = mid + 1
		opt = l
		init = Fraction(h - c)
		ans = 2
		for i in range(opt - 1, opt + 1):
			if i < 0:
				continue
			if Fraction(t) < Fraction((h + c) * i + h, 2*i + 1):
				dist = Fraction((h + c) * i + h, 2*i + 1) - Fraction(t)
			else:
				dist = Fraction(t) - Fraction((h + c) * i + h, 2*i + 1)
			if dist < init:
				init = dist
				ans = 2 * i + 1
		res.append(ans)

print('\n'.join(map(str, res)))


import math
import sys
input = sys.stdin.readline
ts = int(input())

# (h + c) * n / 2n = (h + c) / 2
# ((h + c) * n + h) / (2n + 1) = (h + c) * n/(2n + 1) + h/(2n + 1)

res = []
for cs in range(ts):
	h, c, t = map(int, input().split())
	if 2 * t <= (h + c):
		res.append(2)
	else:
		l, r = 0, int(1e18)
		while l < r:
			mid = (l + r) // 2
			if (h + c) * mid + h <= t * (mid + mid + 1):
				r = mid
			else:
				l = mid + 1
		opt = l
		init = abs(t - (h + c) / 2)
		ans = 2
		for i in range(opt, opt + 3):
			dist = abs(t - (((h + c) * i + h) / (i + i + 1)))
			if dist < init:
				init = dist
				ans = 2 * i + 1
		res.append(ans)

print('\n'.join(map(str, res)))


import math
import sys
input = sys.stdin.readline
ts = int(input())

# (h + c) * n / 2n = (h + c) / 2
# ((h + c) * n + h) / (2n + 1) = (h + c) * n/(2n + 1) + h/(2n + 1)

res = []
for cs in range(ts):
	h, c, t = map(int, input().split())
	if 2 * t <= (h + c):
		res.append(2)
	else:
		l, r = 0, int(1e9)
		while l < r:
			mid = (l + r) // 2
			if (h + c) * mid + h <= t * (mid + mid + 1):
				r = mid
			else:
				l = mid + 1
		opt = l
		init = abs(t - (h + c) / 2)
		ans = 2
		for i in range(opt - 2, opt + 2):
			if i < 0:
				continue
			dist = abs(t - (((h + c) * i + h) / (i + i + 1)))
			if dist < init:
				init = dist
				ans = 2 * i + 1
		res.append(ans)

print('\n'.join(map(str, res)))


import math
import sys
input = sys.stdin.readline
ts = int(input())

# (h + c) * n / 2n = (h + c) / 2
# ((h + c) * n + h) / (2n + 1) = (h + c) * n/(2n + 1) + h/(2n + 1)

res = []
for cs in range(ts):
	h, c, t = map(int, input().split())
	l, r = 0, int(1e11)
	while l < r:
		mid = (l + r) // 2
		if (h + c) * mid + h <= t * (mid + mid + 1):
			r = mid
		else:
			l = mid + 1
	opt = l
	init = abs(t - (h + c) / 2)
	ans = 2
	for i in range(opt - 2, opt + 3):
		if i < 0:
			continue
		dist = abs(t - (((h + c) * i + h) / (i + i + 1)))
		if dist < init:
			init = dist
			ans = 2 * i + 1
	res.append(ans)

print('\n'.join(map(str, res)))


import math
import sys
input = sys.stdin.readline
ts = int(input())

# (h + c) * n / 2n = (h + c) / 2
# ((h + c) * n + h) / (2n + 1) = (h + c) * n/(2n + 1) + h/(2n + 1)

res = []
for cs in range(ts):
	h, c, t = map(int, input().split())
	if 2 * t <= (h + c):
		res.append(2)
	else:
		l, r = 0, 1000000000
		while l < r:
			mid = (l + r) // 2
			if (h + c) * mid + h <= t * (mid + mid + 1):
				r = mid
			else:
				l = mid + 1
		opt = l
		init = abs(t - (h + c) / 2)
		ans = 2
		for i in range(opt, opt + 3):
			dist = abs(t - (((h + c) * i + h) / (i + i + 1)))
			if dist < init:
				init = dist
				ans = 2 * i + 1
		res.append(ans)

print('\n'.join(map(str, res)))


import math
import sys
input = sys.stdin.readline
ts = int(input())

# (h + c) * n / 2n = (h + c) / 2
# ((h + c) * n + h) / (2n + 1) = (h + c) * n/(2n + 1) + h/(2n + 1)

res = []
for cs in range(ts):
	h, c, t = map(int, input().split())
	if 2 * t <= (h + c):
		res.append(2)
	else:
		l, r = 0, 1000000000
		while l < r:
			mid = (l + r) // 2
			if (h + c) * mid + h <= t * (mid + mid + 1):
				r = mid
			else:
				l = mid + 1
		opt = l
		init = h - c
		ans = 0
		for i in range(opt, opt + 2):
			dist = abs(t - (((h + c) * i + h) / (i + i + 1)))
			if dist < init:
				init = dist
				ans = 2 * i + 1
		res.append(ans)

print('\n'.join(map(str, res)))


def solve(h, c, t):
    if (h+c) ==2*t:
        return 2
    a = abs((c-t)//(c+h-2*t))
    res = a+a-1
    tmp = abs((a*h+(a-1)*c)/float(res)-t)
    if a>=2 and abs(((a-1)*h+(a-2)*c)/float(a-1+a-1-1)-t)<=tmp:
        res = 2*a-3
        tmp = abs(((a-1)*h+(a-2)*c)/float(a-1+a-1-1)-t)
    if abs(((a+1)*h+a*c)/float(2*a+1)-t)<tmp:
        res = 2*a+1
    return res

t = int(input())
for _ in range(t):
    n, m, k = list(map(int, input().split()))
    print(solve(n,m, k))


def solve(h, c, t):
    if (h+c) ==2*t or c==t:
        return 2
    a = abs((c-t)//(c+h-2*t))
    res = a+a-1
    tmp = abs((a*h+(a-1)*c)/float(res)-t)
    if abs(((a+1)*h+a*c)/float(2*a+1)-t)<tmp:
        res = 2*a+1
    return res

t = int(input())
for _ in range(t):
    n, m, k = list(map(int, input().split()))
    print(solve(n,m, k))


def solve(h, c, t):
    if (h+c) ==2*t or c==t:
        return 2
    if h<=t:
        return 1
    a = abs((c-t)//(c+h-2*t))
    res = a+a-1
    tmp = abs((a*h+(a-1)*c)/float(res)-t)
    if a>=2 and abs(((a-1)*h+(a-2)*c)/float(a-1+a-1-1)-t)<=tmp:
        res = 2*a-3
        tmp = abs(((a-1)*h+(a-2)*c)/float(a-1+a-1-1)-t)
    if abs(((a+1)*h+a*c)/float(2*a+1)-t)<tmp:
        res = 2*a+1
    if abs(h+c-2*t)<tmp:
        res = 2
        tmp = abs(h+c-2*t)
    if abs(h+c-2*t) == tmp and res>2:
        res = 2
    if abs(h-t)<=tmp:
        res = 1
    return res

t = int(input())
for _ in range(t):
    n, m, k = list(map(int, input().split()))
    print(solve(n,m, k))


def solve(h, c, t):
    if (h+c) ==2*t or c==t:
        res = 2
    if h<=t:
        res = 1
    a = abs((c-t)//(c+h-2*t))
    res = 2*a-1
    tmp = abs(a*h+(a-1)*c -t*res)
    if a>=2 and abs((a-1)*h+(a-2)*c -(2*a-3)*t)<=tmp:
        res = 2*a-3
        tmp = abs((a-1)*h+(a-2)*c -(2*a-3)*t)
    if abs((a+1)*h+a*c -(2*a+1)*t)<tmp:
        res = 2*a+1
    if abs(res*(h+c)/2.0 -t*res)<tmp:
        res = 2
        tmp = abs((h+c)/2.0*res -t*res)
    if abs(res*(h+c)/2.0 -t*res) == tmp and res>2:
        res = 2
    if abs(h*res -t*res)<=tmp:
        res = 1
    return res

t = int(input())
for _ in range(t):
    n, m, k = list(map(int, input().split()))
    print(solve(n,m, k))


import math
def solve(h, c, t):
    if (h+c)>=2*t:
        return 2
    a = (c-t)/float(h+c-2*t)
    a1 = math.floor(a)
    a2 = math.ceil(a)
    tmp = (2*a2-1)*(a1*h+(a1-1)*c)+(2*a1-1)*(a2*h+(a2-1)*c)-2*t*(2*a1-1)*(2*a2-1)
    if tmp<=0:
        return 2*a1-1
    else:
        return 2*a2-1

t = int(input())
for _ in range(t):
    h,c,t = list(map(int, input().split()))
    print(solve(h, c, t))
'''
a, b, c = 41, 15, 30

t1 = (3*a+2*b)/float(5)
t2 = (4*a+3*b)/float(7)
print(t1, t2)
'''


def solve(h, c, t):
    a = abs((c-t)//(c+h-2*t))
    res = 2*a-1
    tmp = abs(a*h+(a-1)*c -t*res)
    if a>=2 and abs((a-1)*h+(a-2)*c -(2*a-3)*t)<=tmp:
        res = 2*a-3
        tmp = abs((a-1)*h+(a-2)*c -(2*a-3)*t)
    if abs((a+1)*h+a*c -(2*a+1)*t)<tmp:
        res = 2*a+1
    if abs(res*(h+c)/2.0 -t*res)<tmp:
        res = 2
        tmp = abs((h+c)/2.0*res -t*res)
    if abs(res*(h+c)/2.0 -t*res) == tmp and res>2:
        res = 2
    if abs(h*res -t*res)<=tmp:
        res = 1
    return res

t = int(input())
for _ in range(t):
    n, m, k = list(map(int, input().split()))
    print(solve(n,m, k))


import math
def solve(h, c, t):
    if (h+c)>=2*t:
        return 2
    a = (c-t)/float(h+c-2*t)
    a1 = math.floor(a)
    a2 = math.ceil(a)
    tmp = (2*a2-1)*(a1*h+(a1-1)*c)+(2*a1-1)*(a2*h+(a1-1)*c)-2*t
    if tmp<=0:
        return 2*a1-1
    else:
        return 2*a2-1

t = int(input())
for _ in range(t):
    h,c,t = list(map(int, input().split()))
    print(solve(h, c, t))


def solve(h, c, t):
    if (h+c) ==2*t or c==t:
        return 2
    if h<=t:
        return 1
    a = abs((c-t)//(c+h-2*t))
    res = a+a-1
    tmp = abs((a*h+(a-1)*c)/float(res)-t)
    if a>=2 and abs(((a-1)*h+(a-2)*c)/float(a-1+a-1-1)-t)<=tmp:
        res = 2*a-3
        tmp = abs(((a-1)*h+(a-2)*c)/float(a-1+a-1-1)-t)
    if abs(((a+1)*h+a*c)/float(2*a+1)-t)<tmp:
        res = 2*a+1
    return res

t = int(input())
for _ in range(t):
    n, m, k = list(map(int, input().split()))
    print(solve(n,m, k))


def solve(h, c, t):
    if (h+c) ==2*t or c==t:
        return 2
    if h<=t:
        return 1
    a = abs((c-t)//(c+h-2*t))
    res = a+a-1
    tmp = abs((a*h+(a-1)*c)/float(res)-t)
    if a>=2 and abs(((a-1)*h+(a-2)*c)/float(a-1+a-1-1)-t)<=tmp:
        res = 2*a-3
        tmp = abs(((a-1)*h+(a-2)*c)/float(a-1+a-1-1)-t)
    if abs(((a+1)*h+a*c)/float(2*a+1)-t)<tmp:
        res = 2*a+1
    if abs(h+c-2*t)<tmp:
        res = 2
    if abs(h+c-2*t) == tmp and res>2:
        res = 2
    if abs(h-t)<=tmp:
        res = 1
    return res

t = int(input())
for _ in range(t):
    n, m, k = list(map(int, input().split()))
    print(solve(n,m, k))


def solve(h, c, t):
    if (h+c) ==2*t or c==t:
        return 2
    if h<=t:
        return 1
    a = abs((c-t)//(c+h-2*t))

    res = 2*a-1
    tmp = abs(a*h+(a-1)*c -t*res)
    if a>=2 and abs((a-1)*h+(a-2)*c -(2*a-3)*t)<=tmp:
        res = 2*a-3
        tmp = abs((a-1)*h+(a-2)*c -(2*a-3)*t)
    if abs((a+1)*h+a*c -(2*a+1)*t)<tmp:
        res = 2*a+1
    if abs(h+c-2*t)<tmp:
        res = 2
        tmp = abs(h+c-2*t)
    if abs(h+c-2*t) == tmp and res>2:
        res = 2
    if abs(h-t)<=tmp:
        res = 1
    return res

t = int(input())
for _ in range(t):
    n, m, k = list(map(int, input().split()))
    print(solve(n,m, k))


def solve(h, c, t):
    a = abs((c-t)//(c+h-2*t))

    res = 2*a-1
    tmp = abs(a*h+(a-1)*c -t*res)
    if a>=2 and abs((a-1)*h+(a-2)*c -(2*a-3)*t)<=tmp:
        res = 2*a-3
        tmp = abs((a-1)*h+(a-2)*c -(2*a-3)*t)
    if abs((a+1)*h+a*c -(2*a+1)*t)<tmp:
        res = 2*a+1
    if abs(res*(h+c)/2.0 -t*res)<tmp:
        res = 2
        tmp = abs((h+c)/2.0*res -t*res)
    if abs(res*(h+c)/2.0 -t*res) == tmp and res>2:
        res = 2
    if abs(h*res -t*res)<=tmp:
        res = 1
    return res

t = int(input())
for _ in range(t):
    n, m, k = list(map(int, input().split()))
    print(solve(n,m, k))


def solve(h, c, t):
    if (h+c) ==2*t or c==t:
        return 2
    if h<=t:
        return 1
    a = abs((c-t)//(c+h-2*t))

    res = 2*a-1
    tmp = abs(a*h+(a-1)*c -t*res)
    if a>=2 and abs((a-1)*h+(a-2)*c -(2*a-3)*t)<=tmp:
        res = 2*a-3
        tmp = abs((a-1)*h+(a-2)*c -(2*a-3)*t)
    if abs((a+1)*h+a*c -(2*a+1)*t)<tmp:
        res = 2*a+1
    if abs(res*(h+c)/2.0 -t*res)<tmp:
        res = 2
        tmp = abs((h+c)/2.0*res -t*res)
    if abs(res*(h+c)/2.0 -t*res) == tmp and res>2:
        res = 2
    if abs(h*res -t*res)<=tmp:
        res = 1
    return res

t = int(input())
for _ in range(t):
    n, m, k = list(map(int, input().split()))
    print(solve(n,m, k))


max_limit=10**3
T=int(input())
for _ in range(T):
    h,c,t=map(int,input().split())
    d=10**9
    if (h+c)/2==t:
        print(2)
        continue
    for m in range(max_limit):
        avg=(m*h+(m-1)*c)/(2*m-1)
        diff=abs(avg-t)
        if diff<d:
            d=diff
            a=m
    print(2*a-1)


max_limit=10**3
T=int(input())
for _ in range(T):
    h,c,t=map(int,input().split())
    d=10**9
    if t<=(h+c)/2:
        print(2)
        continue
    for m in range(max_limit):
        avg=(m*h+(m-1)*c)/(2*m-1)
        diff=abs(avg-t)
        if diff<d:
            d=diff
            a=m
    print(2*a-1)


max_limit=10**4
T=int(input())
for _ in range(T):
    h,c,t=map(int,input().split())
    d=10**9
    if t<=(h+c)/2:
        print(2)
        continue
    for m in range(max_limit):
        avg=(m*h+(m-1)*c)/(2*m-1)
        diff=abs(avg-t)
        if diff<d:
            d=diff
            a=m
    print(2*a-1)


max_limit=10**6
T=int(input())
for _ in range(T):
    h,c,t=map(int,input().split())
    d=10**9
    if (h+c)/2==t:
        print(2)
        continue
    for m in range(max_limit):
        avg=(m*h+(m-1)*c)/(2*m-1)
        diff=abs(avg-t)
        if diff<d:
            d=diff
            a=m
    print(2*a-1)


#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

from fractions import Fraction

def foo(h,c,n):
    return Fraction(n*h+(n-1)*c, 2*n-1)

ttt = inn()
for tt in range(ttt):
    h,c,t = inm()
    if 5*h+c<=6*t:
        print(1)
    elif 2*t<=(h+c):
        print(2)
    else:
        mn = 1
        mx = 10**16
        found = False
        while mx-mn>1:
            mid = (mn+mx)//2
            f = foo(h,c,mid)
            if f==t:
                found = True
                break
            elif f<t:
                mx = mid
            else:
                mn = mid
        if found:
            #ddprint(f"found")
            print(2*mid-1)
            continue
        tn = foo(h,c,mn)
        tx = foo(h,c,mx)
        #ddprint(tn)
        #ddprint(tx)
        if abs(tn-t)>abs(tx-t):
            print(2*mx-1)
        else:
            print(2*mn-1)


#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def foo(h,c,t,n):
    return abs((n*h+(n-1)*c)/(2*n-1)-t)

t = inn()
for tt in range(t):
    h,c,t = inm()
    if h<=t:
        print(1)
    elif 2*t<=(h+c):
        print(2)
    else:
        n = (t-c)//(2*t-h-c)
        vm = foo(h,c,t,n-1) if n>=1 else BIG
        v = foo(h,c,t,n)
        vp = foo(h,c,t,n+1)
        mn = min([vm,v,vp])
        #ddprint(f"n {n} vm {vm} v {v} vp {vp} mn {mn}")
        if mn==vm:
            print(2*n-3)
        elif mn==v:
            print(2*n-1)
        else:
            print(2*n+1)


#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

q = inp[0]
q.times do
  n = inp[0]
  t = inp
  m = na(n,0)
  n.times do |i|
    m[t[i]-1] = i
  end
  head = 0
  n.times do |num_i|
    if m[num_i] > head
      ((head+1)..m[num_i]).reverse_each do |i|
        t[i] = t[i-1]
        m[t[i]-1] = i
      end
      t[head] = num_i + 1
      head = m[num_i]
    else
      head +=  1
    end
    break if head >= (n-1)
  end
  puts t.join(" ")
end


#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

q = inp[0]
q.times do
  n = inp[0]
  t = inp
  m = na(n,0)
  n.times do |i|
    m[t[i]-1] = i
  end
  head = 0
  n.times do |num_i|
    if m[num_i] > head
      while(t[head] <= num_i and head<num_i)
        head += 1
      end
      ((head+1)..m[num_i]).reverse_each do |i|
        t[i] = t[i-1]
      end
      t[head] = num_i + 1
      head = m[num_i]
    end
    break if head >= (n-1)
  end
  puts t.join(" ")
end


#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

q = inp[0]
q.times do
  n = inp[0]
  t = inp
  m = na(n,0)
  n.times do |i|
    m[t[i]-1] = i
  end
  head = 0
  barrier = 0
  n.times do |num_i|
    if m[num_i] > head
      ((head+1+barrier)..m[num_i]).reverse_each do |i|
        t[i] = t[i-1]
      end
      t[head+barrier] = num_i + 1
      head = m[num_i]
      barrier = 0
    elsif (m[num_i] == head or m[num_i] == head - 1)
      barrier = 1
    end
    break if head == (n-1)
  end
  puts t.join(" ")
end


#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

q = inp[0]
q.times do
  n = inp[0]
  t = inp
  m = na(n,0)
  n.times do |i|
    m[t[i]-1] = i
  end
  head = 0
  n.times do |num_i|
    if m[num_i] > head
      while(t[head] <= num_i)
        head += 1
      end
      ((head+1)..m[num_i]).reverse_each do |i|
        t[i] = t[i-1]
        m[t[i]-1] += 1
      end
      t[head] = num_i + 1
      head = m[num_i]
    end
    break if head >= (n-1)
  end
  puts t.join(" ")
end


def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

q = inp[0]
q.times do
  n = inp[0]
  t = inp
  m = na(n,0)
  n.times do |i|
    m[t[i]-1] = i
  end
  head = 0
  n.times do |num_i|
    if m[num_i] > head
      ((head+1)..m[num_i]).reverse_each do |i|
        t[i] = t[i-1]
        m[t[i]-1] += 1
      end
      t[head] = num_i + 1
      head = m[num_i]
    elsif m[num_i] == head
      head +=  1
    end
    break if head >= (n-1)
  end
  puts t.join(" ")
end


def combine(a,b):
	if (len(a) == 0):
		return b
	if(len(b) == 0):
		return a
	if(a[-1] > b[0]):
		return a[:-1] + [b[0]] + [a[-1]] + b[1:]
	return a + b

def f(a):
	if(len(a) == 0):
		return a
	if(len(a) == 1):
		return a
	d = min(a)
	k = a.index(d)
	if(k == len(a)-1):
		return [a[-1]] + a[:-1]
	return [d] + combine(a[:k],f(a[k+1:]))

q = int(raw_input())

for i in range(q):
	n = int(raw_input())
	x = list(map(int,raw_input().split()))
	print ''.join(str(i) + " " for i in f(x))


def combine(a,b):
	if (len(a) == 0):
		return b
	if(len(b) == 0):
		return a
	if(a[-1] > b[0]):
		return a[:-1] + [b[0]] + [a[-1]] + b[1:]
	return a + b

def f(a):
	if(len(a) == 0):
		return a
	if(len(a) == 1):
		return a
	d = min(a)
	k = a.index(d)
	if(k == 0):
		return a
	if(k == len(a)-1):
		return [a[-1]] + a[:-1]
	return combine([d] + a[:k],f(a[k+1:]))

q = int(raw_input())

for i in range(q):
	n = int(raw_input())
	x = list(map(int,raw_input().split()))
	print ''.join(str(i) + " " for i in f(x))


def combine(a,b):
	if (len(a) == 0):
		return b
	if(len(b) == 0):
		return a
	if(a[-1] > b[0]):
		return a[:-1] + [b[0]] + [a[-1]] + b[1:]
	return a + b

def f(a):
	if(len(a) == 0):
		return a
	if(len(a) == 1):
		return a
	d = min(a)
	k = a.index(d)
	if(k == 0):
		return [d] + f(a[1:])
	if(k == len(a)-1):
		return [a[-1]] + a[:-1]
	return [d] + a[:k-1] + f([a[k-1]] + a[k+1:])

q = int(raw_input())

for i in range(q):
	n = int(raw_input())
	x = list(map(int,raw_input().split()))
	print ''.join(str(i) + " " for i in f(x))


from sys import stdin, stdout

def swap(index1, index2, arreglo):
    temp = arreglo[index1]
    arreglo[index1] = arreglo[index2]
    arreglo[index2] = temp

def moverX(indexX, x, arreglo, cambios):
    while indexX > 0 and arreglo[indexX - 1] > x and cambios[indexX - 1] == 0:
        swap(indexX, indexX - 1, arreglo)
        cambios[indexX - 1] = 1
        indexX -= 1

for zxzczx in xrange(int(stdin.readline())):
    n = int(stdin.readline())
    permutation = list(map(int, stdin.readline().split()))
    changes = [0] * (n - 1)
    for i in xrange(n - 1):
        moverX(permutation.index(i + 1), i + 1, permutation, changes)
    stdout.write(" ".join(list(map(str,permutation))) + "\n")


t=int(raw_input().strip())
for i in range(t):
    n = int(raw_input().strip())
    l= [int(i) for i in raw_input().strip().split()]
    count=1
    steps=n-1
    s=[]
    while steps and count<=n:
        # print l,count
        index=l.index(count)
        if index+1<n:
            if l[index+1]<l[index]:
                if index not in s:
                    l[index],l[index+1]=l[index+1],l[index]
                    steps-=1
                    s.append(index)
                    count+=1
                    continue
        if index-1>=0:
            if l[index]<l[index-1]:
                if index-1 not in s:
                    l[index],l[index-1]=l[index-1],l[index]
                    steps-=1
                    s.append(index-1)
                    count+=1
                    continue

        count+=1
    for k in l:
        print k,
    print "\r"


t=int(raw_input().strip())
for p in range(t):
    n = int(raw_input().strip())
    l= [int(i) for i in raw_input().strip().split()]
    count=1
    steps=n-1
    s=[0]*n
    for i in range(n):
        for k in range(n-1,0,-1):
            if s[k-1]==0 and l[k-1]>l[k]:
                s[k-1]=1
                l[k],l[k-1]=l[k-1],l[k]

    for k in l:
        print k,
    print "\r"


t=int(raw_input().strip())
for i in range(t):
    n = int(raw_input().strip())
    l= [int(i) for i in raw_input().strip().split()]
    count=1
    steps=n-1
    s=[]
    while steps and count<=n:
        # print l,count
        index=l.index(count)
        if index+1<n:
            if l[index+1]<l[index]:
                if index not in s:
                    l[index],l[index+1]=l[index+1],l[index]
                    steps-=1
                    s.append(index)
                    count+=1
                    continue
        if index-1>=0:
            if l[index]<l[index-1]:
                if index-1 not in s:
                    l[index],l[index-1]=l[index-1],l[index]
                    steps-=1
                    s.append(index-1)
                    count+=1
                    continue

        count+=1
    print l


#include <stdio.h>

int main(void) {
    int t,i,j,k,l,n,a[100],pos[100];
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        scanf("%d",&n);
        for(j=0;j<n;j++)
        {
            scanf("%d",&a[j]);
            pos[a[j]-1]=j;
        }
        //for(j=0;j<n;j++) printf("%d %d //",a[j],pos[j]);
        int position=0;
        for(j=0;j<n;j++)
        {
            if(pos[j]>position)
            {
                for(k=pos[j];k>position;k--)
                {
                    int temp=a[k];
                    a[k]=a[k-1];
                    a[k-1]=temp;
   //                 temp=pos[a[k]-1];
 //                   pos[a[k]-1]=pos[a[k-1]-1];
//                    pos[a[k-1]-1]=temp;
                }
                position=pos[j];
            }
            else position+=1;
        }
        for(j=0;j<n;j++)
        {
            printf("%d ",a[j]);
        }
        printf("\n");
    }
	return 0;
}


#include <stdio.h>

int main(void) {
    int t,i,j,k,l,n,a[100],pos[100],kk,position;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        scanf("%d",&n);
        for(j=0;j<n;j++)
        {
            scanf("%d",&a[j]);
            pos[a[j]-1]=j;
        }
        position=0;
        kk=0;
        for(j=0;j<n;j++)
        {
            if(kk&&pos[j]==position-1) position+=1;
            else if(!kk&&pos[j]==position) position+=1;
            else if(pos[j]>position)
            {
                for(k=pos[j];k>position+1;k--)
                {
                    int temp=a[k];
                    a[k]=a[k-1];
                    a[k-1]=temp;
                    kk=1;
                }
                if(a[position]>a[position+1])
                {
                    int temp=a[position+1];
                    a[position+1]=a[position];
                    a[position]=temp;
                }
                position=pos[j];
            }

            if(position==n) break;
        }
        for(j=0;j<n;j++)
        {
            printf("%d ",a[j]);
        }
        printf("\n");
    }
	return 0;
}


#include <stdio.h>

int main(void) {
    int t,i,j,k,l,n,a[100],pos[100];
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        scanf("%d",&n);
        for(j=0;j<n;j++)
        {
            scanf("%d",&a[j]);
            pos[a[j]-1]=j;
        }
        //for(j=0;j<n;j++) printf("%d %d //",a[j],pos[j]);
        int position=0;
        for(j=0;j<n;j++)
        {
            if(pos[j]>position)
            {
                for(k=pos[j];k>position;k--)
                {
                    int temp=a[k];
                    a[k]=a[k-1];
                    a[k-1]=temp;
   //                 temp=pos[a[k]-1];
 //                   pos[a[k]-1]=pos[a[k-1]-1];
//                    pos[a[k-1]-1]=temp;
                }
                position=pos[j];
            }
            else if(a[j]==j+1) position+=1;
        }
        for(j=0;j<n;j++)
        {
            printf("%d ",a[j]);
        }
        printf("\n");
    }
	return 0;
}


#include <stdlib.h>
#include <stdio.h>
#include <math.h>
static void QuickSort (int *a, int left, int right) {      // dlya vvoda 0 i n - 1
    int comp, tmp, i, j;
    i = left; j = right;
    comp = a[(left + right)/2];
    do {
        while (a[i] < comp && i < right)
            i++;
        while (comp < a[j] && j > left)
            j--;
        if (i <= j) {
            tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
            i++, j--;
            }
    } while (i <= j);
    if (left < j)
        QuickSort (a, left, j);
    if (i < right)
        QuickSort (a, i, right);
}
int main(int argc, char *argv[])
{
    int q;
    scanf("%d", &q);
    int a[101];
    for(int i = 0; i < q; ++i) {
        int n;
        scanf("%d", &n);
        int in;
        for(int i = 0; i < n; ++i) {
            scanf("%d", &a[i]);
        }
        int t = n - 1;
        int c = 0;
        for(int j = c; j < n && t; j = c) {
            int i = c, i_min = c;
            for(int i = c; i < n; ++i) {
                if(a[i] < a[i_min]) {
                    i_min = i;
                }
            }
            i = i_min;
            for(i; i > c && t; --i) {
                int swap = a[i];
                a[i] = a[i - 1];
                a[i - 1] = swap;
                t--;
            }
            if(i_min == c) {
                c = i_min + 1;
            } else {
                c = i_min;
            }
        }
        for(int i = 0; i < n; ++i) {
            printf("%d ", a[i]);
        }
        printf("\n");
    }
    return 0;
}


#include <stdlib.h>
#include <stdio.h>
#include <math.h>
static void QuickSort (int *a, int left, int right) {      // dlya vvoda 0 i n - 1
    int comp, tmp, i, j;
    i = left; j = right;
    comp = a[(left + right)/2];
    do {
        while (a[i] < comp && i < right)
            i++;
        while (comp < a[j] && j > left)
            j--;
        if (i <= j) {
            tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
            i++, j--;
            }
    } while (i <= j);
    if (left < j)
        QuickSort (a, left, j);
    if (i < right)
        QuickSort (a, i, right);
}
int main(int argc, char *argv[])
{
    int q;
    scanf("%d", &q);
    int a[101];
    for(int i = 0; i < q; ++i) {
        int n;
        scanf("%d", &n);
        int in;
        for(int i = 0; i < n; ++i) {
            scanf("%d", &a[i]);
        }
        int t = n - 1;
        for(int j = 0; j < n && t; ++j) {
            int i = 0;
            while(a[i] != j + 1) {
                i++;
            }
            for(i; i > j && t; --i) {
                int swap = a[i];
                a[i] = a[i - 1];
                a[i - 1] = swap;
                t--;
            }
        }
        for(int i = 0; i < n; ++i) {
            printf("%d ", a[i]);
        }
        printf("\n");
    }
    return 0;
}


#include <stdlib.h>
#include <stdio.h>
#include <math.h>
static void QuickSort (int *a, int left, int right) {      // dlya vvoda 0 i n - 1
    int comp, tmp, i, j;
    i = left; j = right;
    comp = a[(left + right)/2];
    do {
        while (a[i] < comp && i < right)
            i++;
        while (comp < a[j] && j > left)
            j--;
        if (i <= j) {
            tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
            i++, j--;
            }
    } while (i <= j);
    if (left < j)
        QuickSort (a, left, j);
    if (i < right)
        QuickSort (a, i, right);
}
int main(int argc, char *argv[])
{
    int q;
    scanf("%d", &q);
    int a[101];
    for(int i = 0; i < q; ++i) {
        int n;
        scanf("%d", &n);
        int in;
        for(int i = 0; i < n; ++i) {
            scanf("%d", &a[i]);
        }
        int t = n - 1;
        int c = 0;
        for(int j = c; j < n && t; j = c) {
            int i = c, i_min = c;
            for(int i = c; i < n; ++i) {
                if(a[i] < a[i_min]) {
                    i_min = i;
                }
            }
            i = i_min;
            for(i; i > c && t; --i) {
                int swap = a[i];
                a[i] = a[i - 1];
                a[i - 1] = swap;
                t--;
            }
            c = i_min + 1;
        }
        for(int i = 0; i < n; ++i) {
            printf("%d ", a[i]);
        }
        printf("\n");
    }
    return 0;
}


#include <stdio.h>
#include <string.h>
int a[110];
int GetMin(int arr[],int n,int m)
{
    int temp,min=1000000;

    for(temp=n;temp<=m;temp++)
    {
        if(arr[temp]<min)
        min = arr[temp];
    }
    return min;
}
void swap(int* a,int* b)
{
    int tmp;
    tmp = *b;
    *b = *a;
    *a = tmp;
}

void f(int arr[],int left,int n)
{
    int i;
    if(left<n){
    for(i=left;;i++)
    {
        if(arr[i]==GetMin(a,left,n))
        {
            for(int j=i;j>left;j--) swap(&a[j],&a[j-1]);
            break;
        }
    }
    f(a,i+1,n);
    }
    return;

}
int main()
{
    int q,n,tmp,k;
    a[0]=1110;
    scanf("%d",&q);
    while(q--)
    {
        k=1;
        memset(a,0,sizeof(a));
        a[0]=1110;
        scanf("%d",&n);
        for(int i=1;i<=n;i++) scanf("%d",&a[i]);
        for(int i=1;i<=n;i++)
        {
            if(a[i]==GetMin(a,k,n))
            {
                for(int j=i;j>=k;j--)
                {
                    if(j!=1&&a[j]<a[j-1]){
                    tmp = a[j];
                    a[j] = a[j-1];
                    a[j-1] = tmp;
                }}
                k=i+1;
            }
        }
        for(int i=1;i<=n;i++) printf("%d ",a[i]);
        printf("\n");
    }
    return 0;
}


#include <stdio.h>
#include <string.h>
int a[110];
int GetMin(int arr[],int n,int m)
{
    int temp,min=1000000;

    for(temp=n;temp<=m;temp++)
    {
        if(arr[temp]<min)
        min = arr[temp];
    }
    return min;
}
void swap(int* a,int* b)
{
    int tmp;
    tmp = *b;
    *b = *a;
    *a = tmp;
}

void f(int arr[],int left,int n)
{
    int i;
    if(left<n){
    for(i=left;;i++)
    {
        if(arr[i]==GetMin(a,left,n))
        {
            for(int j=i;j>left;j--) swap(&a[j],&a[j-1]);
            break;
        }
    }
    f(a,i+1,n);
    }
    return;

}
int main()
{
    int q,n,tmp,k;
    a[0]=1110;
    scanf("%d",&q);
    while(q--)
    {
        k=1;
        memset(a,0,sizeof(a));
        a[0]=1110;
        scanf("%d",&n);
        for(int i=1;i<=n;i++) scanf("%d",&a[i]);
        for(int i=1;i<=n;i++)
        {
            printf("%d\n",GetMin(a,k,n));
            if(a[i]==GetMin(a,k,n))
            {
                for(int j=i;j>=k;j--)
                {
                    if(j!=1&&a[j]<a[j-1]){
                    tmp = a[j];
                    a[j] = a[j-1];
                    a[j-1] = tmp;
                }}
                k=i+1;
            }
        }
        for(int i=1;i<=n;i++) printf("%d ",a[i]);
        printf("\n");
    }
    return 0;
}


#include <stdio.h>
void oneswitch(int i, int* a){
    int hold = a[i];
    a[i] = a[i+1];
    a[i+1] = hold;
}

int main(int argc, const char * argv[]) {
    int q;
    scanf("%d", &q);
    int n;
    for (int i = 0; i < q; i++){
        scanf("%d", &n);
        int array[n];
        for (int j = 0; j < n; j++){
            scanf("%d", &array[j]);
        }
        int sum = 0;
        int threshold = 0;
        int idx = 0;
        for (int j = 1; j <= n; j++){
//            printf("fix %d\n", j);
            int num_switch = 0;
            for (int k = 0; k < n; k++){
                if (array[k] == j){
                    idx = k;
                    break;
                }
            }
//            printf("idx %d, thr %d\n", idx, threshold);
            if (idx == threshold){
                threshold++;
            }
            else{
                if (idx > threshold){
                    num_switch = idx - threshold;
                    if ((sum + num_switch) > (n - 1)){
                        num_switch = n - 1 - sum;
                    }
                    for (int k = idx - 1; k >= idx - num_switch; k--)
                        oneswitch(k, array);
                    sum += num_switch;
                    if (sum == n - 1) break;
                }
                threshold = idx;
            }
        }
        for (int i = 0; i < n; i++)
            printf("%d ", array[i]);
        printf("\n");
    }
    return 0;
}


//
//  main.c
//  Minimize the Permutation
//
//  Created by Hai Trinh on 12/12/19.
//  Copyright © 2019 Hai Trinh. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    int q;
    scanf("%d", &q);
    int n;
    for (int i = 0; i < q; i++){
        scanf("%d", &n);
        int array[n];
        for (int j = 0; j < n; j++){
            scanf("%d", &array[j]);
        }
        int sum = 0;
        for (int j = 1; j <= n; j++){
            int idx = 0;
            int num_switch = 0;
            int idx_rem;
            for (int k = 0; k < n; k++){
                if (array[k] == j){
                    idx = k;
                    num_switch = idx - j + 1;
                    break;
                }
            }
            if ((sum + num_switch) > (n - 1)){
                num_switch = n - 1 - sum;
                idx_rem = idx - num_switch;
                for (int k = idx - 1; k >= idx_rem; k--)
                    array[k+1] = array[k];
                array[idx_rem] = j;
                break;
            }
            else{
                for (int k = idx -1 ; k >= j - 1 ; k--){
                    array[k+1] = array[k];
                }
                array[j-1] = j;
                sum += num_switch;
            }
        }
        for (int i = 0; i < n; i++)
            printf("%d ", array[i]);
        printf("\n");
    }
    return 0;
}


#include <stdio.h>
void oneswitch(int i, int* a){
    int hold = a[i];
    a[i] = a[i+1];
    a[i+1] = hold;
}

int main(int argc, const char * argv[]) {
    int q;
    scanf("%d", &q);
    int n;
    for (int i = 0; i < q; i++){
        scanf("%d", &n);
        int array[n];
        for (int j = 0; j < n; j++){
            scanf("%d", &array[j]);
        }
        int sum = 0;
        int threshold = 0;
        int idx = 0;
        for (int j = 1; j <= n; j++){
//            printf("fix %d\n", j);
            int num_switch = 0;
            for (int k = 0; k < n; k++){
                if (array[k] == j){
                    idx = k;
                    break;
                }
            }
//            printf("idx %d, thr %d\n", idx, threshold);
            if (idx == threshold){
                threshold++;
            }
            else{
                if (idx > threshold){
                    num_switch = idx - threshold;
                    if ((sum + num_switch) > (n - 1)){
                        num_switch = n - 1 - sum;
                    }
                    for (int k = idx - 1; k >= idx - num_switch; k--)
                        oneswitch(k, array);
                    sum += num_switch;
                    if (sum == n - 1) break;
                    threshold = idx;
                }
            }
//            for (int i = 0; i < n; i++)
//                printf("%d ", array[i]);
//            printf("\n");
        }
        for (int i = 0; i < n; i++)
            printf("%d ", array[i]);
        printf("\n");
    }
    return 0;
}


#include<stdio.h>
int main()
{
    int t,j;
    scanf("%d",&t);
    for(j=0;j<t;j++)
    {
        int n,ar[100],a[100]={0};
        scanf("%d",&n);
        for(int i=0;i<n;i++)
        {
            scanf("%d",&ar[i]);
        }
        int left=0,search=1;

        while(left<=n-1)
        {
            int temp=left;
            while(ar[temp]!=search&&temp<n)
            {
                temp++;
            }
            if(ar[temp]==search&&temp!=left)
            {
                a[left]=search;
                for(int i=left+1;i<=temp;i++)
                {
                    a[i]=ar[i-1];
                }
                ar[temp]=ar[temp-1];
                left=temp;
            }
            else if(left==temp&&ar[temp]==search)
            {
                a[left]=search;
                left++;
            }
            search++;
        }

        for(int i=0;i<n;i++)
            printf("%d ",a[i]);
         printf("\n");
    }

}


#include<stdio.h>
int main()
{
    int t,j;
    scanf("%d",&t);
    for(j=0;j<t;j++)
    {
        int n,ar[100]={0},a[100]={0},i;
        scanf("%d",&n);
        for( i=0;i<n;i++)
        {
            scanf("%d",&ar[i]);
        }
        int left=0,search=1;

        while(left<=n-1)
        {
            int temp=left;
            while(ar[temp]!=search&&temp<n)
            {
                temp++;
            }
            if(ar[temp]==search&&temp!=left)
            {
                a[left]=search;
                for(i=left+1;i<=temp;i++)
                {
                    a[i]=ar[i-1];
                }
                ar[temp]=ar[temp-1];
                left=temp;
            }
            else if(left==temp&&ar[temp]==search)
            {
                a[left]=search;
                left++;
            }
            search++;
        }

      for( i=0;i<n;i++)
            printf("%d ",a[i]);
         printf("\n");
    }

}


#include<stdio.h>
int main()
{
    int t,j;
    scanf("%d",&t);
    for(j=0;j<t;j++)
    {
        int n,ar[100],a[100]={0};
        scanf("%d",&n);
        for(int i=0;i<n;i++)
        {
            scanf("%d",&ar[i]);
        }
        int left=0,search=1;
        if(n>1)
        {
        while(left<n-1)
        {
            int temp=left;
            while(ar[temp]!=search&&temp<n)
            {
                temp++;
            }
            if(ar[temp]==search&&temp!=left)
            {
                a[left]=search;
                for(int i=left+1;i<=temp;i++)
                {
                    a[i]=ar[i-1];
                }
                ar[temp]=ar[temp-1];
                left=temp;
            }
            else if(left==temp&&ar[temp]==search)
            {
                a[left]=search;
                left++;
            }
            search++;
        }
        }
        else
        {
            a[0]=ar[0];
        }
        for(int i=0;i<n;i++)
            printf("%d ",a[i]);
         printf("\n");
    }

}


#include<stdio.h>
int main()
{
    int t,j;
    scanf("%d",&t);
    for(j=0;j<t;j++)
    {
        int n,ar[100],a[100]={0};
        scanf("%d",&n);
        for(int i=0;i<n;i++)
        {
            scanf("%d",&ar[i]);
        }
        int left=0,search=1;

        while(left<=n-1)
        {
            int temp=left;
            while(ar[temp]!=search&&temp<n)
            {
                temp++;
            }
            if(ar[temp]==search&&temp!=left)
            {
                a[left]=search;
                for(int i=left+1;i<=temp;i++)
                {
                    a[i]=ar[i-1];
                }
                ar[temp]=ar[temp-1];
                left=temp;
            }
            else if(left==temp&&ar[temp]==search)
            {
                a[left]=search;
                left++;
            }
            search++;
        }

      for(int i=0;i<n;i++)
            printf("%d ",a[i]);
         printf("\n");
    }

}


#include<stdio.h>
int min(int a , int b , int ar[])
{
	int mini=a;
	while(a<=b)
	{
		if(ar[a]<ar[mini])
		{
			mini=a;
		}
		a++;
	}
	return mini;
}
int main()
{
	int t;
	scanf("%d", &t);
	int ar[101];
	int loc[101];
	int n;
	while(t--)
	{
		for(int i=0;i<101;i++)
			loc[i]=-1;
		scanf("%d", &n);
		for(int i=1;i<=n;i++)
			scanf("%d", &ar[i]);
		int k=n-1;
		if(n==1)
		{
			printf("%d \n", ar[1]);
			continue;
		}
		int pos=1;
		int nxt,l=0;
		while(pos<n)
		{
			nxt=min(pos,n,ar);
			if(nxt>pos)
			{
			int temp=ar[nxt];
			for(int i=nxt;i>pos;i--)
			{
				ar[i]=ar[i-1];
			}
			ar[pos]=temp;
			pos=nxt;
			}
			else
				pos++;
		}
		for(int i=1;i<=n;i++)
			printf("%d ", ar[i]);
		printf("\n");
	}

}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main()
{
    int T, t, i, j, N, A[1000], flag[1000], count=0, curr, temp;
    scanf("%d", &T);
    for(t=0;t<T;t=t+1)
    {
        scanf("%d", &N);
        for(i=1;i<=N;i=i+1)
        {
            scanf("%d", &A[i]);
            flag[i]=0;
        }
        temp=1;
        count=1;
        while(count<=N-1 && temp<=N)
        {
            for(i=1;i<=N;i=i+1)
            {
                if(A[i]==temp)
                {
                    break;
                }
            }
            if(i>=2)
            {
                for(j=i-1;j>=1;j=j-1)
                {
                    if(flag[j]==1)
                    {
                        break;
                    }
                    else if(A[j]<A[j+1])
                    {
                        break;
                    }
                    else
                    {
                        curr=A[j];
                        A[j]=A[j+1];
                        A[j+1]=curr;
                        flag[j]=1;
                        count=count+1;
                    }
                }
            }
            temp=temp+1;
        }
        for(i=1;i<=N;i=i+1)
        {
            printf("%d ", A[i]);
        }
        printf("\n");
    }
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main()
{
    int T, t, i, j, N, A[10000], flag[1000], count=0, curr, temp;
    scanf("%d", &T);
    for(t=0;t<T;t=t+1)
    {
        scanf("%d", &N);
        for(i=1;i<=N;i=i+1)
        {
            scanf("%d", &A[i]);
            flag[i]=0;
        }
        temp=1;
        count=0;
        while(count<=N-1 && temp<=N)
        {
            for(i=1;i<=N;i=i+1)
            {
                if(A[i]==temp)
                {
                    break;
                }
            }
            for(j=i-1;j>=1;j=j-1)
            {
                if(flag[j]==1)
                {
                    break;
                }
                else
                {
                    curr=A[j];
                    A[j]=A[j+1];
                    A[j+1]=curr;
                    flag[j]=1;
                    count=count+1;
                }
            }
            temp=temp+1;
        }
        for(i=1;i<=N;i=i+1)
        {
            printf("%d ", A[i]);
        }
        printf("\n");
    }
}


/*  AUTHOR:AKASH JAIN
*   USERNAME:akash19jain
*   TIME: 06-11-2019 23:57:59
*/
// #include<algorithm>
// #include <bits/stdc++.h>
// using namespace std;

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define SC1(x)          scanf("%lld",&x)
#define SC2(x,y)        scanf("%lld%lld",&x,&y)
#define SC3(x,y,z)      scanf("%lld%lld%lld",&x,&y,&z)
#define SCS(x)          scanf("\n%s", x)
#define SCA(a,n)        for(long long i=0;i<n;i++)    scanf("%lld",&a[i]);
#define PF1(x)          printf("%lld\n",x)
#define PF2(x,y)        printf("%lld %lld\n",x,y)
#define PF3(x,y,z)      printf("%lld %lld %lld\n",x,y,z)
#define PFA(a,n)        for(long long i=0;i<n;i++)    printf("%lld ",a[i]); printf("\n");
#define PFN                printf("\n")
#define REP(i,n)        for(long long i=0;i<(n);++i)
#define FOR(i,a,b)      for(long long i=(a);i<=(b);++i)
#define FORD(i,a,b)     for(long long i=(a);i>=(b);--i)
#define WHILE(n)        while(n--)
#define MEM(a, b)       memset(a, (b), sizeof(a))
#define ITOC(c)         ((char)(((ll)'0')+c))
#define MID(s,e)        (s+(e-s)/2)
#define SZ(a)            strlen(a)
#define MOD             1000000007
#define MAX             10000000005
#define MIN             -10000000005
#define PI              3.1415926535897932384626433832795
#define DEB(x)          printf("The value of \"%s\" is: %d\n",#x,x)
#define CASES           ll t;SC1(t);while(t--)
#define ABS(a)          ((a>0)?a:-(a))
#define SWAP(a,b)        ll z=a;a=b;b=z
#define SWAPC(a,b)        char z=a;a=b;b=z

const int INF = 1<<29;
typedef long long ll;
typedef unsigned long long ull;
#define FILEIO(name) \  freopen(name".in", "r", stdin); \   freopen(name".out", "w", stdout);
int cmp(const void * a,const void * b);
long long maxv(long long a,long long b);
long long minv(long long a,long long b);
long long gcd(long long u,long long v);
long long digits(long long n);
bool ispoweroftwo(long long n);
bool isvowel(char x);
ll chartoint(char ch);
ll CEIL(ll x,ll y);
ll FLOOR(ll x,ll y);
int main()
{
    CASES
    {
        ll n;
        SC1(n);
        ll arr[n];
        SCA(arr,n);
        bool c[n];
        MEM(c,false);
        REP(i,n)
        {
            FORD(j,n-1,1)
            {
                if(arr[j]<arr[j-1] && c[j]==false)
                {
                    SWAP(arr[j],arr[j-1]);
                    c[j]=1;
                }
            }
        }
        PFA(arr,n);
    }

    return 0;
}

//qsort(arr,n,sizeof(arr[0]),cmp);
int cmp (const void * a, const void * b)
{
    if( *(ll*)a - *(ll*)b < 0 ) return -1;
    if( *(ll*)a - *(ll*)b > 0 ) return 1;
        return 0;
}
long long maxv(long long a,long long b)
{
    if(a>b) return a;
        return b;
}
long long minv(long long a,long long b)
{
    if(a<b) return a;
        return b;
}
long long gcd(long long u,long long v)
{
    if (v == 0) return u;
       return gcd(v, u%v);
}
long long digits(long long n)    //to calculate no of digits in a number
{
    return floor(log10(n))+1;
}
bool ispoweroftwo(long long x)
{
    return x && (!(x&(x-1)));
}
bool isvowel(char x)
{
    return(x=='a' || x== 'e' ||x=='i' || x== 'o' || x=='u' );
}
ll chartoint(char ch)
{
    if(ch>='A' && ch<='Z') return(ch-'A');
    else if(ch>='0' && ch<='9') return (ch-'0');
    else if(ch>='a' && ch<='z') return (ch-'a');
    else return 0;
}
ll CEIL(ll x,ll y)
{
    if(x%y==0) return(x/y);
    else return(x/y +1);
}

ll FLOOR(ll x,ll y)
{
    if(x%y==0) return(x/y);
    else return(x/y -1);
}


#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,flag=0,o1=0,o2=0,b1,x,m,l,max,x1,y1,k[4]={0},sum2,min,f,r,o,sum1,y,count1[4][5]={0},flag1=0, a[1000000];
scanf("%lld",&test);
while(test--){
scanf("%lld",&n);
for(i=0;i<n;i++){
   scanf("%lld",&a[i]);
}
x1=0;
y1=0;
min=a[x1];
while(1){
    if(x1==n-1){
        break;
    }
    min=a[x1];
    for(i=x1;i<n;i++){
        if(a[i]<min){
            min=a[i];
            y1=i;
        }
    }
    if(y1==x1){
        y1++;
        x1++;
    }else{
        for(i=y1-1;i>=x1;i--){
            x=a[i];
            a[i]=a[i+1];
            a[i+1]=x;
        }
        a[x1]=min;
         x1=y1;
    }

}
for(i=0;i<n;i++){
    printf("%lld ",a[i]);
}
printf("\n");
}
return 0;
}


#include<stdio.h>
int main()
{
	int t;
	scanf("%d", &t);
	int ar[101];
	int loc[101];
	int n;
	while(t--)
	{
		for(int i=0;i<101;i++)
			loc[i]=-1;
		scanf("%d", &n);
		for(int i=1;i<=n;i++)
			scanf("%d", &ar[i]);
		int k=n-1;
		if(n==1)
		{
			printf("%d \n", ar[1]);
			continue;
		}
		int j=1;
		int t,min;
		while(j<=n && k>0)
		{
			min=j+k;
			if(min>n)
				min=n;
			while(ar[min]==-1)
				min++;
			if(min>n)
				min=n;
			t=min;
			while(t>=j)
			{
				if(ar[t]<ar[min] && ar[t]!=-1)
					min=t;
				t--;
			}
			if(min==j)
			{
				printf("%d ", ar[j]);
				j++;
				continue;
			}
			printf("%d ", ar[min]);
			ar[min]=-1;
			k-=(min-j);
			for(int i=j;i<=min;i++)
				if(ar[i]!=-1)
					printf("%d ", ar[i]);
			j=min+1;

		}
	       printf("\n");
	}

}


#include<stdio.h>
int main()
{
	int t;
	scanf("%d", &t);
	int ar[101];
	int loc[101];
	int n;
	while(t--)
	{
		for(int i=0;i<101;i++)
			loc[i]=-1;
		scanf("%d", &n);
		for(int i=1;i<=n;i++)
			scanf("%d", &ar[i]);
		int k=n-1;
		if(n==1)
		{
			printf("%d \n", ar[1]);
			continue;
		}
		int j=1;
		int t,min,l=0;
		while(j<=n && k>0)
		{
			min=j+k+l;
			if(min>n)
				min=n;
			while(ar[min]==-1)
				min++;
			if(min>n)
				min=n;
			t=min;
			while(t>=j)
			{
				if(ar[t]<ar[min] && ar[t]!=-1)
					min=t;
				t--;
			}
			if(min==j)
			{
				printf("%d ", ar[j]);
				j++;
				continue;
			}
			printf("%d ", ar[min]);
			ar[min]=-1;
			k-=(min-j);
			int temp=j;
			j=min-1;
			l=1;
			while(ar[j]==-1)
			{
				l++;
				j--;
			}
			if(min==n)
			{
				for(int i=temp;i<min;i++)
				{
					if(ar[i]!=-1)
						printf("%d ", ar[i]);
				}
				break;
			}
			else
			{
				for(int i=temp;i<min-1;i++)
				{
					if(ar[i]!=-1)
						printf("%d ", ar[i]);
				}
			}

		}
		printf("\n");
	}

}


/* codeforces.com/contest/1256/problem/B */

#include <stdio.h>
#include <stdlib.h>

/*
void solve(int n, int * a){
    int ttrack[n];
    int i, min = 1, j = 0, k = 0, tmp;
    for(i = 0; i < n; i++)
        ttrack[i] = 0;
    for(i = 0; i < n; i++){
        tmp = a[i];
        a[i] = a[k];
        a[k] = tmp;
        if(a[k] == min){
            ttrack[min-1] = 1;
            if(k == i) k++;
            else k = i;
            while (ttrack[j] && j < (n-1)) j++;
            min = j+1;
        }else{
            ttrack[a[i]-1] = 1;
        }
    }
    for(i = 0; i < n-1; i++)
        printf("%d ", a[i]);
    printf("%d\n",a[n-1]);
    return;
}
*/

void solve(int n, int * a){
    int ttrack[n];
    int i, k = 0, p = 0, j;
    int min = 1;
    for(i = 0; i < n; i++)
        ttrack[i] = 0;
    i = 0;
    while (i < n){
        //printf("i = %d \n", i);
        if(a[i] == min){
            //printf("here \n");
            ttrack[min-1] = 1;
            if(i == k){
                k++;
            }else{
                a[i] = a[i-1];
                j = i-1;
                while(j > k){
                    a[j] = a[j-1];
                    ttrack[a[j]-1] = 1;
                    j--;
                }
                a[k] = min;
                k = i;
                i--;
            }
            while (ttrack[p] && p < (n-1)) p++;
            min = p+1;
        }
        i++;
    }
    for(i = 0; i < n-1; i++)
        printf("%d ", a[i]);
    printf("%d\n",a[n-1]);
    return;
}

int main(){
    setbuf(stdout, NULL);
    int q, n, i, j;
    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%d", &n);
        int t[n];
        for(j = 0; j < n; j++){
            scanf("%d", &t[j]);
        }
        solve(n, t);
    }
    return 0;
}


/* codeforces.com/contest/1256/problem/B */

#include <stdio.h>
#include <stdlib.h>

void solve(int n, int * a){
    int ttrack[n];
    int i, min = 1, j = 0, k = 0, tmp;
    for(i = 0; i < n; i++)
        ttrack[i] = 0;
    for(i = 0; i < n; i++){
        tmp = a[i];
        a[i] = a[k];
        a[k] = tmp;
        if(a[k] == min){
            ttrack[min-1] = 1;
            if(k == i) k++;
            else k = i;
            while (ttrack[j] && j < (n-1)) j++;
            min = j+1;
        }else{
            ttrack[a[i]-1] = 1;
        }
    }
    for(i = 0; i < n-1; i++)
        printf("%d ", a[i]);
    printf("%d\n",a[n-1]);
    return;
}

int main(){
    setbuf(stdout, NULL);
    int q, n, i, j;
    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%d", &n);
        int t[n];
        for(j = 0; j < n; j++){
            scanf("%d", &t[j]);
        }
        solve(n, t);
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int swap(int*,int,int);

int main()
{
    int q,n,i,arr[105],mini,done[105],cnt,j;
    scanf("%d",&q);
    while(q--)
    {
        scanf("%d",&n);
        memset(done,0,sizeof(done));
        mini = 1;
        cnt = 0;
        for(i = 0; i<n; i++)
            scanf("%d",arr+i);

        while((mini<=n)&&(cnt<n))
        {
            for(i = 0; i<n; i++)
            {
                if(arr[i]==mini)
                {

                    if(!done[i])
                    {
                        //printf("i = %d, mini = %d\n",i,mini);
                        if(swap(arr,i,i-1))
                        {
                            //printf("mini = %d, swap %d-%d\n",mini,i,i-1);
                            done[i] = 1;
                            cnt++;
                            mini--;

                            /*printf("%d :",cnt);
                            for(j = 0; j<n; j++)
                                printf("%d ",arr[j]);
                            puts("");*/

                            break;
                        }
                    }
                }
            }
            mini++;
        }

        for(i = 0; i<n; i++)
            printf("%d ",arr[i]);
        puts("");
    }
    return 0;
}

int swap(int* arr,int a,int b)
{
    if((b<0)||(arr[a]>arr[b])) return 0;
    int tmp = arr[b];
    arr[b] = arr[a];
    arr[a] = tmp;
    return 1;
}


#include <stdio.h>
#include <stdlib.h>
int nums[100], record[99];
void swap(int *a, int *b)
{
    *a ^= *b;
    *b ^= *a;
    *a ^= *b;
}

int main()
{
    int q, i, j, k = 0, n;
    scanf("%d", &q);
    for(i = 0; i < q; i++)
    {
        scanf("%d", &n);
        for(j = 0; j < n; j++)
            scanf("%d", &nums[j]);

        for(j = 1; j <= n; j++)
        {
            while(nums[k] !=  j)
                k++;
            while(record[k-1] == 0 && k > 0 && nums[k-1] > nums[k])
            {
                swap(&nums[k], &nums[k-1]);
                record[k-1] = 1;
                k--;
            }
            k = 0;

        }
        for(j = 0; j < n; j++)
        {
            printf("%d ", nums[j]);
        }
        printf("\n");
        for(j = 0; j < 100; j++)
        {
            nums[j] = 0;
            if(j < 99)
                record[j] = 0;
        }
    }
    return 0;
}


#include<stdio.h>
#include<string.h>

void solve(){
	int n, i, j=1, end=0, l;
	_Bool visited[101];
	int in[100];
	memset(visited, 0, sizeof(visited));
	scanf("%d", &n);
	for(i=0;i<n;++i) scanf("%d", in+i);
	for(i=0;i<n;++i){
		visited[in[i]]=1;
		if(in[i]==j){
			for(l=i;l>end;--l){
				if(in[l]>in[l-1]) break;
				in[l]+=in[l-1];
				in[l-1]=in[l]-in[l-1];
				in[l]-=in[l-1];
			}
			end=i;
			while(j<=n && visited[j]) ++j;
		}
	}
	for(i=0;i<n;++i) printf("%d ", in[i]);
	putchar(10);
}

int main(){
	int q;
	scanf("%d", &q);
	while(q--) solve();
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void zero(int *a, int n) {
    for (int i = 0; i < n; i++)
        a[i] = 0;
}

int main(void) {
    int again, n, a[100], was[100], min, swap, stop;
    scanf("%d", &again);
    for (; again > 0; again--) {
        zero(a, 100);
        zero(was, 100);
        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
            scanf("%d", &a[i]);
            a[i]--;
        }
        min = 0;
        stop = 0;
        if (a[0] == 0) {
            min++;
            stop++;
            was[0] = 1;
        }
        for (int i = 1; i < n; i++) {
            was[a[i]] = 1;
            if (a[i] == min) {
                if (i == stop) {
                    stop++;
                } else {
                    for (int j = i; j > stop; j--) {
                        swap = a[j];
                        a[j] = a[j - 1];
                        a[j - 1] = swap;
                    }
                    stop = i;
                }
                min++;
                while (was[min])
                    min++;
            }
        }
        for (int i = 0; i < n; i++)
            printf("%d ", a[i] + 1);
        putchar('\n');
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void zero(int *a, int n) {
    for (int i = 0; i < n; i++)
        a[i] = 0;
}

void swapper(int *one, int *two) {
    int three = *one;
    *one = *two;
    *two = three;
}

int main(void) {
    int again, n, a[100], was[100], min, stop;
    scanf("%d", &again);
    for (; again > 0; again--) {
        zero(a, 100);
        zero(was, 100);
        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
            scanf("%d", &a[i]);
            a[i]--;
        }
        min = 0;
        stop = 0;
        for (int i = 0; i < n; i++) {
            was[a[i]] = 1;
            if (a[i] == min) {
                for (int j = i; j > stop && a[j] < a[j - 1]; j--)
                    swapper(&a[j], &a[j - 1]);
                stop = i;
                while (was[min])
                    min++;
            }
        }
        for (int i = 0; i < n; i++)
        printf("%d ", a[i] + 1);
        putchar('\n');
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void zero(int *a, int n) {
    for (int i = 0; i < n; i++)
        a[i] = 0;
}

int main(void) {
    int again, n, a[100], was[101], swap;
    scanf("%d", &again);
    for (; again > 0; again--) {
        zero(a, 100);
        zero(was, 101);
        scanf("%d", &n);
        for (int i = 0; i < n; i++)
            scanf("%d", &a[i]);
        for (int i = 0, j = 1, stop = 0; i < n; i++) {
            was[a[i]] = 1;
            if (a[i] == j) {
                for (int k = i; k > stop; k--) {
                    swap = a[k];
                    a[k] = a[k - 1];
                    a[k - 1] = swap;
                }
                if (stop == i)
                    stop++;
                else
                    stop = i;
                j++;
                while (was[j])
                    j++;
            }
        }
        for (int i = 0; i < n; i++)
            printf("%d ", a[i]);
        putchar('\n');
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void zero(int *a, int n) {
    for (int i = 0; i < n; i++)
        a[i] = 0;
}

void swapper(int *one, int *two) {
    int three = *one;
    *one = *two;
    *two = three;
}

int main(void) {
    int again, n, a[100], was[100], min, stop;
    scanf("%d", &again);
    for (; again > 0; again -= 1) {
        zero(a, 100);
        zero(was, 100);
        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
            scanf("%d", &a[i]);
            a[i]--;
        }
        min = 0;
        stop = 0;
        for (int i = 0; i < n; i++) {
            was[a[i]] = 1;
            if (a[i] == min) {
                for (int j = i; j > stop && a[j] < a[j - 1]; j -= 1)
                    swapper(&a[j], &a[j - 1]);
                stop = i;
                while (was[min])
                    min++;
            }
        }
        for (int i = 0; i < n; i++)
            printf("%d ", a[i] + 1);
        putchar('\n');
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void zero(int *a, int n) {
    for (int i = 0; i < n; i++)
        a[i] = 0;
}

void swap(int *one, int *two) {
    int three = *one;
    *one = *two;
    *two = three;
}

int main(void) {
    int again, n, a[100], was[100], min, swap, stop;
    scanf("%d", &again);
    for (; again > 0; again--) {
        zero(a, 100);
        zero(was, 100);
        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
            scanf("%d", &a[i]);
            a[i]--;
        }
        min = 0;
        stop = 0;
        for (int i = 0; i < n; i++) {
            was[a[i]] = 1;
            if (a[i] == min) {
                for (int j = i; j > stop && a[j] < a[j - 1]; j--)
                    swap(&a[j], &a[j - 1]);
                stop = i;
                while (was[min])
                    min++;
            }
        }
        for (int i = 0; i < n; i++)
            printf("%d ", a[i] + 1);
        putchar('\n');
    }
    return 0;
}