//poj 3797
//sep9
#include <iostream>
using namespace std;
int dp[2][128];
int n,m;
int solve()
{
if(m>n)
swap(m,n);
memset(dp,0,sizeof(dp));
int *crt=dp[0],*nxt=dp[1];
crt[0]=1;
for(int i=n-1;i>=0;--i)
for(int j=m-1;j>=0;--j){
for(int s=0;s<(1<<m);++s){
nxt[s]=0;
if((s>>j)&1)
nxt[s]=crt[s&(~(1<<j))];
else{
if(j+1<m&&!((s>>(j+1))&1))
nxt[s]+=crt[s|(1<<(j+1))];
if(i+1<n)
nxt[s]+=crt[s|(1<<j)];
}
}
swap(crt,nxt);
}
return crt[0];
}
int main()
{
int cases;
scanf("%d",&cases);
for(int t=1;t<=cases;++t){
scanf("%d",&n);
m=4;
printf("%d %d\n",t,solve());
}
return 0;
}