Problem Description
Given a positive integer N, you should output the most right digit of N^N.
Input
The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow. Each test case contains a single positive integer N(1<=N<=1,000,000,000).
Output
For each test case, you should output the rightmost digit of N^N.
Sample Input
2 3 4
#includeusing namespace std;int main(){ long long int n; int i; int T; cin>>T; int sum; while (T--) {cin>>n; int m=n; n=n%10; if(n==4)//4是偶数,所以只可能有偶数个4相乘。根据规律只有一个结果 6 cout<<6<