#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> int main(void){ int n,t,ss,s,sss; scanf("%d",&t); while(t--){ scanf("%d",&n); s=n/3; ss=n%3; sss=(s*2+ss)%3; printf("%d\n",sss); } }