//author: Angle Lee (Software Engineering CS in AHU)
//time : 2012.12.30
//version: 1.0
//sources: hdu1996
//links: http://acm.hdu.edu.cn/showproblem.php?pid=1996
//无耻地利用库函数
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
int m;
cin>>m;
_int64 j=(_int64)pow(3.0,m*1.0);
cout<<j<<endl;
}
return 0;
}