arr = [int(input()) for _ in range(int(input()))] p = int(input()) for i in arr: print(i**p)