from math import sqrt N,M,mod=map(int,input().split()) A=pow(M,N,mod) ANS=[] while A>0: k=int(sqrt(A)) if k==0: ANS.append(mod) else: ANS.append(k) A-=k*k A%=mod while len(ANS)<6: ANS.append(mod) print("YES") print(*ANS)