fork download
  1. ile = int(input())
  2.  
  3. for i in range(ile):
  4. c = input()
  5.  
  6. a = int((c.split())[0])
  7. b = int((c.split())[1])
  8.  
  9. print(str(a ** b)[-1])
Success #stdin #stdout 0.03s 9712KB
stdin
2
2 3
3 3
stdout
8
7