Consider the infinite sequence s of positive integers, created by repeating the following steps:

  1. Find the lexicographically smallest triple of positive integers (a, b, c) such that 
    * a ⊕ b ⊕ c = 0, where ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR). 
    * a, b, c are not in s. 
Here triple of integers (a_1, b_1, c_1) is considered to be lexicographically smaller than triple (a_2, b_2, c_2) if sequence [a_1, b_1, c_1] is lexicographically smaller than sequence [a_2, b_2, c_2]. 
  2. Append a, b, c to s in this order. 
  3. Go back to the first step. 



You have integer n. Find the n-th element of s.

You have to answer t independent test cases.

A sequence a is lexicographically smaller than a sequence b if in the first position where a and b differ, the sequence a has a smaller element than the corresponding element in b.

Input

The first line contains a single integer t (1 ≤ t ≤ 10^5) — the number of test cases.

Each of the next t lines contains a single integer n (1≤ n ≤ 10^{16}) — the position of the element you want to know.

Output

In each of the t lines, output the answer to the corresponding test case.

Example

Input


9
1
2
3
4
5
6
7
8
9


Output


1
2
3
4
8
12
5
10
15

Note

The first elements of s are 1, 2, 3, 4, 8, 12, 5, 10, 15, ... 
#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const long long mod = 998244353;
const long long maxn = 1e5 + 10;
long long p[2] = {1000000007, 998244353};
long long seed[2] = {500000004, 500000004};
long long ksm(long long x, long long y) {
  long long re = 1, xx = x % mod;
  while (y > 0) {
    if (y & 1) {
      re *= xx;
      re %= mod;
    }
    xx *= xx;
    xx %= mod;
    y >>= 1;
  }
  return re;
}
long long tt, n;
long long dp[66], qzh[66];
long long c[2][4] = {{0, 2, 3, 1}, {0, 3, 1, 2}};
int main() {
  dp[1] = 1;
  for (int i = 2; i <= 30; i++) dp[i] = dp[i - 1] * 4;
  scanf("%lld", &tt);
  while (tt--) {
    scanf("%lld", &n);
    if (n == 1) {
      printf("1\n");
      continue;
    } else if (n == 2) {
      printf("2\n");
      continue;
    } else if (n == 3) {
      printf("3\n");
      continue;
    }
    long long x, y, z;
    x = n / 3;
    y = n % 3;
    if (y > 0)
      x++;
    else
      y = 3;
    long long sum = 0;
    for (int i = 1; i <= 30; i++) {
      sum += dp[i];
      if (sum >= x) {
        sum -= dp[i];
        x -= sum;
        z = dp[i];
        break;
      }
    }
    x--;
    if (y == 1) {
      printf("%lld\n", z + x);
    } else {
      z *= y;
      long long ls = 0;
      long long xx = 1;
      while (x > 0) {
        ls += c[y - 2][x % 4] * xx;
        xx *= 4;
        x /= 4;
      }
      ls += z;
      printf("%lld\n", ls);
    }
  }
  return 0;
}
