from math import sqrt
for i in range(int(input())):
    x=int(input())
    x=int((sqrt(1+8*x)-1)/2)
    print(x)

from math import sqrt
for i in range(int(input())):
    x=int(input())
    x=int((sqrt(1+8*x)-1)/2)
    print(x)
