The Infinite String
Medium Accuracy: 20.0% Submissions: 953 Points: 4

Consider a string A = "12345".  An infinite string s is built by performing infinite steps on A recursively. In ith step, A is concatenated with ‘$’ i times followed by reverse of A. A=A|$...\$|reverse(A), where | denotes concatenation.
Input :

First line contains an integer Q, the number of queries. Q line follows. Each line contains an integer POS i.e. the position for query.

Output:

For each query print the character in the infinite string at position POS in separate lines.

Constraints:
1<=Q<=10^5
1<=POS<=10^12

Examples:
Input:

2
3
10

Output:

3
2