#include #define debug(x) cerr<<#x<<" = "< #define mp make_pair #define pb push_back using namespace std; namespace IO{ const int BS=(1<<23)+5; int Top=0; char Buffer[BS],OT[BS],*OS=OT,*HD,*TL,SS[20]; const char *fin=OT+BS-1; char Getchar(){if(HD==TL){TL=(HD=Buffer)+fread(Buffer,1,BS,stdin);} return (HD==TL)?EOF:*HD++;} void flush(){fwrite(OT,1,OS-OT,stdout),OS=OT;} void Putchar(char c){*OS++ =c;if(OS==fin)flush();} void write(int x){ if(!x){Putchar('0');return;} if(x<0) x=-x,Putchar('-'); while(x) SS[++Top]=x%10,x/=10; while(Top) Putchar(SS[Top]+'0'),--Top; } inline LL read(){ LL nm=0; bool fh=1; char cw=getchar(); for(;!isdigit(cw);cw=getchar()) fh^=(cw=='-'); for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0'); return fh?nm:-nm; } } using namespace IO; #define M 10020 #define INF 1000000005 int n,m,F[M]; inline LL solve(LL n){ if(n&1){ n>>=1; if(n%3==0) return 1+(n/3)*4ll; return n/3; } else{ n>>=1; if(n%3==2) return n+n-1; return n; } return -1; } int main(){ //freopen(".in","r",stdin); //freopen(".out","w",stdout); for(int Cas=read();Cas;--Cas) cout<