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("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
using namespace std;
const long long MOD = 1000000007;
const long long MOD2 = 1000000009;
const long long BASE = 257;
const long long INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const long long MX = 100010;
const double EPS = 1e-9;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    long long n;
    cin >> n;
    long long gr = (n - 1) / 3;
    long long ind = (n - 1) % 3;
    long long cur = 0;
    long long add = 0;
    while (cur <= gr - (1ll << add)) {
      cur += (1ll << add);
      add += 2;
    }
    long long fs = gr - cur + (1ll << add);
    if (ind == 0) {
      cout << fs << '\n';
    } else {
      long long cnt = gr - cur;
      long long se = 1ll << (add + 1);
      long long curpw = 0;
      while (cnt) {
        long long md = cnt % 4;
        long long td = 0;
        if (md == 1)
          td = 2;
        else if (md == 2)
          td = 3;
        else if (md == 3)
          td = 1;
        se += td << curpw;
        curpw += 2;
        cnt /= 4;
      }
      if (ind == 1) {
        cout << se << '\n';
      } else {
        cout << (se ^ fs) << '\n';
      }
    }
  }
}
