#include using namespace std; #define ll long long const int ans[]={0, 1, 1, 0, 3, 0}, k[]={3, 4, 3, 1, 6, 1}; int T; ll n; int main() { scanf("%d", &T); while(T--){ scanf("%lld", &n); printf("%lld\n", ans[n%6]+k[n%6]*(n/6)); } return 0; }