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>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (auto i = begin(v); i != end(v); i++)
    os << *i << (i == end(v) - 1 ? "" : " ");
  return os;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto i = begin(v); i != end(v); i++) is >> *i;
  return is;
}
long long recur(pair<long long, long long> a, pair<long long, long long> b,
                pair<long long, long long> c, long long nth) {
  if (a.second == a.first) {
    if (nth == 0) return a.first;
    if (nth == 1) return b.first;
    return c.first;
  }
  long long step = (a.second - a.first + 1LL) / 4LL;
  if (nth < step * 3LL) {
    return recur({a.first, a.first + step - 1LL},
                 {b.first, b.first + step - 1LL},
                 {c.first, c.first + step - 1LL}, nth);
  } else if (nth < step * 6LL) {
    return recur({a.first + step, a.first + 2LL * step - 1LL},
                 {b.first + step * 2LL, b.first + 3LL * step - 1LL},
                 {c.first + step * 3LL, c.first + 4LL * step - 1LL},
                 nth - step * 3LL);
  } else if (nth < step * 9LL) {
    return recur({a.first + step * 2LL, a.first + 3LL * step - 1LL},
                 {b.first + 3LL * step, b.first + 4LL * step - 1LL},
                 {c.first + step, c.first + 2LL * step - 1LL},
                 nth - step * 6LL);
  } else {
    return recur({a.first + step * 3LL, a.first + 4LL * step - 1LL},
                 {b.first + step, b.first + 2LL * step - 1LL},
                 {c.first + step * 2LL, c.first + 3LL * step - 1LL},
                 nth - step * 9LL);
  }
}
long long find_nth(long long n) {
  for (long long i = 0; i < 58; i += 2) {
    long long start = 1LL << i;
    long long end = start * 4LL - 1;
    if (n >= start && n <= end) {
      return recur({start, start * 2LL - 1LL}, {start * 2LL, start * 3LL - 1LL},
                   {start * 3LL, end}, n - start);
    }
  }
  throw 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    cout << find_nth(x) << "\n";
  }
  return 0;
}
