Given two numbers a and b. Find the last digit of a raised to the power b.
First line of input contains an Integer T, which denotes the number of test cases. Each line of the test case contains two integer a and b.
Print the last digit of a raised to the power b.
1 <= T <= 105
1 <= a,b <= 1018
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.