#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define dbg(x) cout<<#x<<" : "<<x<<endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define inf 1000000000000000000
priority_queue<ll,vector<ll>,greater<int>> qp;
priority_queue<ll> qr;
#define maxn 100005
#define mod 1000000000000000009
#define cnt_ones __builtin_popcount
ll mul(ll a,ll n,ll mo){
ll res = a, ans = 0;
while(n){
if(n%2) ans = (ans+res)%mo;
res = (res+res)%mo;
n/=2;
}
return ans;
}
ll po(ll a,ll n, ll mo){
ll res=a, ans=1;
while(n){
if(n%2) ans=mul(ans,res,mo)%mo;
res=mul(res,res,mo)%mo;
n/=2;
}
return ans;
}
int main(){
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
ll phi = 1000000000000000008;
ll tc;
cin>>tc;
while(tc--){
ll fi,se,th;
cin>>fi>>se>>th;
ll dd = po(se,th,phi);
ll answer = po(fi,dd,mod);
cout<<answer<<'\n';
}
return 0;
}
1
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCB1bnNpZ25lZCBsb25nIGxvbmcgCiNkZWZpbmUgZGJnKHgpIGNvdXQ8PCN4PDwiIDogIjw8eDw8ZW5kbAojZGVmaW5lIHJlcChpLGEsYikgZm9yKGludCBpPShhKTtpPD0oYik7aSsrKQojZGVmaW5lIGluZiAxMDAwMDAwMDAwMDAwMDAwMDAwCnByaW9yaXR5X3F1ZXVlPGxsLHZlY3RvcjxsbD4sZ3JlYXRlcjxpbnQ+PiBxcDsKcHJpb3JpdHlfcXVldWU8bGw+IHFyOwojZGVmaW5lIG1heG4gMTAwMDA1CiNkZWZpbmUgbW9kIDEwMDAwMDAwMDAwMDAwMDAwMDkKI2RlZmluZSBjbnRfb25lcyBfX2J1aWx0aW5fcG9wY291bnQKbGwgbXVsKGxsIGEsbGwgbixsbCBtbyl7CiAgICBsbCByZXMgPSBhLCBhbnMgPSAw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