# include <stdio.h>
int main (void)
{
int t;
int n,j,k;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
if((n%3>2&&n%2>1)||(n==1))
printf("WA\n");
else
{
int x=0,y=0;
if(n%3==1)
{x=2;
y=n/3-1;
printf("%d %d\n",x,y);}
else if(n%3==0)
{
x=0;
y=n/3;
printf("%d %d\n",x,y);}
else if(n%3==2)
{x=1;
y=n/3;
printf("%d %d\n",x,y);}
}
}
return 0;
}