对于x^13
#include <iostream>
#include<stdio.h>
using namespace std;
int mod_pow(int a,int b,int c)
{
int t=a%c,ans=1%c;
while(b){
if(b&1){
ans=ans*t%c;
b--;
}
b=b>>1;
t=t*t%c;
}
return ans;
}
int main()
{
//freopen("in.txt","r",stdin);
int T,N;
scanf("%d",&T);
while(T--){
scanf("%d",&N);
printf("%d\n",mod_pow(N,N,10));
}
return 0;
}