from math import sqrt from random import randint N,M,mod=map(int,input().split()) A=pow(M,N,mod) iniA=A while True: ANS=[] ANS=[randint(1,10**9)] A=iniA-ANS[-1]**2 A%=mod 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) if len(ANS)==6: print("YES") print(*ANS) break