Easy
A chained equation X=Y=Z really gives two equations. Pairing them turns the messy expressions into the clean identities (p−q)2 and (p+q)2. From the two values of p−q and p+q you get all (p,q) pairs, then read off the largest and smallest p3−q3.
1
First pairing p2+q2−29=2pq−20:
p2+q2−2pq=29−20⇒ (p−q)2=9⇒ p−q=±3
2
Second pairing p2+q2−29=52−2pq:
p2+q2+2pq=52+29⇒ (p+q)2=81⇒ p+q=±9
3
All four sign combinations give four (p,q) pairs:
p−q=3, p+q=9:p−q=−3, p+q=9:p−q=3, p+q=−9:p−q=−3, p+q=−9:(p,q)=(6,3)(p,q)=(3,6)(p,q)=(−3,−6)(p,q)=(−6,−3)⇒p3−q3=216−27=189⇒p3−q3=27−216=−189⇒p3−q3=−27+216=189⇒p3−q3=−216+27=−189
4
Max minus min:
max=189,min=−189difference=189−(−189)=378
Difference =378
By symmetry the four values are just ±189, so the answer is simply 2×189=378 — you only ever need to compute one pair.