Rightmost Digit

描述

Given a positive integer N, you should output the most right digit of N^N.

输入

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).

输出

For each test case, you should output the rightmost digit of N^N.

样例

样例输入 #1

2
3
4

样例输出 #1

7
6

<i style="font-size:1px"> </i>

提示

In the first case, 3 * 3 * 3 = 27, so the rightmost digit is 7. In the second case, 4 * 4 * 4 * 4 = 256, so the rightmost digit is 6.
HDOJ-1061
题目来源:HDOJ-1061
时间限制:1000 MS
内存限制:32768 KB
Java 类名:Main
64 位整数占位符:%I64d