#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include<stdio.h>
using namespace std;
long int power(long int n, long int p)
{
if(p==0) return 1;
else if(p%2==0)
return (power(3,p/2)*power(3,p/2));
else
return (power(3,p-1)*3);
}
int main()
{
unsigned long int t,n;
cin>>t;
while(t>0)
{
t--;
cin>>n;
cout<<power(3,n)<<"\n";
}
return 0;
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGxpc3Q+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxzZXQ+CiNpbmNsdWRlIDxxdWV1ZT4KI2luY2x1ZGUgPGRlcXVlPgojaW5jbHVkZSA8c3RhY2s+CiNpbmNsdWRlIDxiaXRzZXQ+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxjYXNzZXJ0PgojaW5jbHVkZSA8ZnVuY3Rpb25hbD4KI2luY2x1ZGUgPG51bWVyaWM+CiNpbmNsdWRlIDx1dGlsaXR5PgojaW5jbHVkZSA8c3N0cmVhbT4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KI2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8Y3N0ZGxpYj4KI2luY2x1ZGUgPGN0aW1lPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGU8c3RkaW8uaD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpsb25nIGludCBwb3dlcihsb25nIGludCBuLCBsb25nIGludCBwKQp7CiAgICBpZihwPT0wKSByZXR1cm4gMTsKICAgIAogICAgZWxzZSBpZihwJTI9PTApIAogICAgcmV0dXJuIChwb3dlcigzLHAvMikqcG93ZX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