a=eval(input()) for b in range(0,6): n=pow(a,b) print(n,end=" " if b!=5 else"")
a=eval(input()) for b in range(0,6): n=pow(a,b) print(n ,end=" ")