1244 个位数字


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

Ray 参加了数学兴趣小组,其中一道题目是求a^b(a的b次方)个位数字是多少,聪明的Ray 一下子就解决了,你是否也像Ray 一样聪明呢?

Input

第一行是一个整数N,表示有N组数据1=0。

Output

输出a^b的个位数字,每组占一行。

Sample

Input

3
3 2
12 9
123456789 121

Output

9
2
9

Comments

There are no comments at the moment.