#include using namespace std; int T,m,a[6]={3,4,3,1,6,1},b[6]={0,1,1,0,3,0}; long long n; int main(){ cin>>T; for(;T;T--){ scanf("%lld",&n),m=n%6; printf("%lld\n",(n/6)*a[m]+b[m]); } return 0; }