N,M,X=map(int,input().split()) A,B,C,D=0,0,0,0 for a in range(33): for b in range(33): for c in range(33): for d in range(33): if a*a+b*b+c*c+d*d==M: A,B,C,D=a%X,b%X,c%X,d%X def f(a1,a2,a3,a4,b1,b2,b3,b4): x=[a1*b1+a2*b2+a3*b3+a4*b4,a1*b2-a2*b1+a3*b4-a4*b3,a1*b3-a2*b4-a3*b1+a4*b2,a1*b4+a2*b3-a3*b2-a4*b1] for i in range(4): x[i]%=X return x ANS=[1,0,0,0] for i in range(62): if (N>>i)&1: ANS=f(ANS[0],ANS[1],ANS[2],ANS[3],A,B,C,D) A,B,C,D=f(A,B,C,D,A,B,C,D) print('YES') print(*ANS,0,0)