# [JavaScript (Node.js)], 404 bytes <!-- language-all: lang-javascript --> (N,f=(n,j=0)=>j>1?(n**.5|0)==n**.5?[[-(n**.5|0)],[n**.5|0]]:[['']]:[...Array(1+2*(n**.5|0))].flatMap((_,i)=>i?f(n-(i-(n**.5|0))**2,j+1).map(b=>[i-(n**.5|0),...b]).filter(e=>!e.includes('')):[]),A=f(N[2]**2),B=f(N[4]**2),C=f(N[5]**2),t=(y,z)=>y.map((e,i)=>Z+=(e-z[i])**2,Z=0)|Z)=>[...A.flatMap(e=>B.flatMap(E=>C.map(d=>[e,E,d]))).find(([a,b,c])=>t(a,b)==N[0]**2&&t(a,c)==N[1]**2&&t(b,c)==N[3]**2),[0,0,0]] [Try it online!][TIO-l03itbkz] [JavaScript (Node.js)]: https://nodejs.org [TIO-l03itbkz]: https://tio.run/##TZDdbsIwDIWfZTfUKW7UllVDSCkCxOV4AKJo6k@KUnUpKt0kEO/euYF1Uy7ic2Idf3GdfWeXojPnPrBtqYeTGOCAlQCLtQiZSOs0WoP1fZ7cSQpXraUMJk@hfJZKraT0vPHinG@6LrtCNI/9qZUpXjVZ/56dAT7QULpZV2ADMH9xzPdjrOcR45/UlotU/ntEys0V45Vpet2BFumL5sYWzVepL@B5jK2kYrgRFRxkrCiK4daJ14fYOZE8RC/gijeiuLpZoB3ScS5ABzdplEM50hbuR/LdnyZ@Gr2dxF6kOxdRUpvGPZaKsZHSlgAywxwLRQk9UEk7PMhwBJjNRqNwRvRr5E9j8UCUIdJRaihae2kbzZv2BCeQUfSGy1dchphEmCwwiWni8AM "JavaScript (Node.js) – Try It Online" Fails because it uses too much memory, but having checked the code I think it should work in theory. Generates every possible representation, as a sum of three squares of positive and/or negative integers, of A, B and C's distances from the origin, with D being the origin. Then looks for a set of A, B and C coordinates that have the correct distances. **UPDATE**: The code works on the first testcase provided by the OP. The coordinates of A, B, C and D, in that order, are: ```js [ [ -64, 0, -48 ], [ 44, -27, -12 ], [ 20, 0, -48 ], [ 0, 0, 0 ] ] ```