import math

for _ in range(int(input())):
    k = int(input())

    
    # i = int(math.sqrt(k))
    # while True:
    #     if (i*(i+1))/2 < k <= (i+1)*(i+2)/2:
    #         print(k - (i*(i+1))/2)
    #         break
    #     else:
    #         i += 1