#include <iostream>
using namespace std;
int potega(int p, int w);
int main()
{
int ile;
cin>>ile;
for(int i=0;i<ile;i++);
{
int p,w;
cin>>p>>w;
cout<<potega(p,w)<<endl;
}
return 0;
}
int potega(int p, int w)
{
if (w==0) return 1;
else return p*potega(p,w-1);
}