Sandu, a teacher in Chefland introduced his students to a new sequence i.e.
0,1,0,1,2,0,1,2,3,0,1,2,3,4........
The Sequence starts from 0 and increases by one till $i$(initially i equals to 1), then repeat itself with $i$ changed to $i+1$
Students being curious about the sequence asks the Nth element of the sequence. Help Sandu to answer the Students
-----Input:-----
- The first-line will contain $T$, the number of test cases. Then the test case follows. 
- Each test case contains a single numbers N.
-----Output:-----
Print the Nth element of the sequence
-----Constraints-----
- $1 \leq T \leq 1000$
- $1 \leq N  \leq 10^{18}$
-----Sample Input:-----
5
8
9
20
32
109
-----Sample Output:-----
2
3
5
4
4
# cook your dish here
t = int(input())
for i in range(t):
 n = int(input())
 x = int((((8*(n+1)+1)**0.5) - 1)/2)
 d = (8*(n+1)+1)**0.5
 if (d-int(d)==0):
  print(x-1)
 else:
  f = (x*(x+1))//2 
  c = n-f
  print(c)

# cook your dish here
t = int(input())
for i in range(t):
 n = int(input())
 x = int((((8*(n+1)+1)**0.5) - 1)/2)
 d = (8*(n+1)+1)**0.5
 if (d-int(d)==0):
  print(x-1)
 else:
  f = (x*(x+1))//2 
  c = n-f
  print(c)
