Help Akash !

There is a town named Chefland where Chef lives. One can only enter the Chefland through visa which is granted by head Chef of the town named Chef Sanjeev Kapoor. Chef Sanjeev is very interested in the singlebit operation, more specifically $XOR$ operation.
Hence he devised a test to get into the Chefland. In the test, he may give a number $N$ with digits say $a_1,a_2,a_3..............a_n$, where $a_i$ represents the $ith$ digit of $N$. One must return him number $X$ with packets of digits say $x_1,x_2,x_2............., x_{n1}/x_n$, where $x_i$ represents $ith$ packet of digits of $X$ such that,
 Print as it is if length of digit of $N$ is $1$.
 $x_i=a_i \oplus a_{i+1}$ when $1\leq i \leq n1$.
 And $x_n=a_n \oplus a_1$, when $i=n$ (Here, $x_i$ may have 2 digits).
Your friend Akash wants to be a Chef in Chefland, but for that, he has to pass the test of the head chef to get the visa. Help Akash to pass the test.
NOTE: Each pair of indices should be considered only once.
Input:
 Firstline will contain $T$, the number of test cases. Then the test case follows.
 Each test case contains a single input $N$.
Output:
For each test case, output in a single answer as the Chef desires.
Constraints
 $1 \leq T \leq 10^5$
 $1 \leq N \leq 10^{18}$
Sample Input:
3 1234 60285 572854
Sample Output:
3175 6210133 25101311
EXPLANATION:
Case 1: N=1234
$ x_1 =1 \oplus 2=3 $
$ x_2 =2 \oplus 3=1 $
$ x_3 =3 \oplus 4=7, and$
$ x_4 =4 \oplus 1=5 $
Hence answer= $3175$
Case 3: N=572854
$ x_1 =5\oplus 7=2$
$ x_2 =7 \oplus 2=5$
$ x_3 =2 \oplus 8=10$
$ x_4 =8 \oplus 5=13$
$ x_5 =5 \oplus 4=1$,and
$ x_6 =4 \oplus 5=1$
Hence answer=$25101311$
Author:  akay_99 
Tags  akay_99, bruteforce, easy, enoc2019, simplemath, string, xor 
Date Added:  22102019 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 