Given 2 Numbers a and b , find the last digit of a^b.
Input:
The first line of input contains an integer t, the number of test cases (t <= 150). t test cases follow. For each test case will appear a and b separated by space. 0 <= a <= 20 0 <= b <= 10^9
Output:
For each test case output an integer per line representing the result.