#include #define ll long long using namespace std; inline ll read(){ ll x=0,f=1;char cc=getchar(); while(cc<'0' || cc>'9') {if(cc=='-') f=-1;cc=getchar();} while(cc>='0' && cc<='9') {x=x*10+cc-'0';cc=getchar();} return x*f; } ll n; int main(){ for(int tt=read();tt;tt--){ n=read(); if(n%2==0) if(n%6==4) printf("%lld\n",n-1); else printf("%lld\n",n/2); else if(n%6==1) printf("%lld\n",n/6*4+1); else printf("%lld\n",n/6); } }