#include #include #include #include #include using namespace std; typedef long long ll; ll read() { ll x=0,f=1; char ch=getchar(); while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();} while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();} return x*f; } int T; ll n; int main() { T=read(); while(T--) { n=read(); if(n&1) { n=n/2; if(n%3==1||n%3==2) printf("%I64d\n",n/3); else{ printf("%I64d\n",5+(n/3-1)*4); } } else{ n/=2; if(n%3==2) printf("%I64d\n",n*2-1); else printf("%I64d\n",n); } } return 0; }