#include
using namespace std;
const int MAX = 31;
int main(void)
{
__int64 f[MAX];
f[1] = 1;
f[2] = 3;
for(int i = 3; i < MAX; i++)
f[i] = f[i-1] + f[i-2] * 2;
int cas, n;
scanf("%d", &cas);
while(cas--)
{
scanf("%d", &n);
printf("%I64d\n", f[n]);
}
return 0;
}