Polyhedron $ABCDEFG$ has six faces.  Face $ABCD$ is a square with $AB = 12;$ face $ABFG$ is a trapezoid with $\overline{AB}$ parallel to $\overline{GF},$ $BF = AG = 8,$ and $GF = 6;$ and face $CDE$ has $CE = DE = 14.$  The other three faces are $ADEG, BCEF,$ and $EFG.$  The distance from $E$ to face $ABCD$ is 12.  Given that $EG^2 = p - q\sqrt {r},$ where $p, q,$ and $r$ are positive integers and $r$ is not divisible by the square of any prime, find $p + q + r.$
[asy] size(200); import three; import graph; defaultpen(linewidth(0.7)+fontsize(8)); currentprojection=orthographic(-30,50,40); triple A=(-6,-6,0), B = (-6,6,0), C = (6,6,0), D = (6,-6,0), E = (2,0,12), H=(-6+2*sqrt(19),0,12), H1=(-6-2*sqrt(19),0,12), F, G, E1 = (6,0,12); F = 1/2*H+1/2*B; G = 1/2*H+1/2*A; draw((A--B--C--D--A)^^(D--E--C)^^(A--G--F--B)^^(G--E--F));draw((G--H--F)^^(H--E1),gray(0.6)); dot(H1^^H,linewidth(2)); label("$A$",A,( 0,-1, 0)); label("$B$",B,( 0, 1, 0)); label("$C$",C,( 0, 1, 0)); label("$D$",D,( 0,-1, 0)); label("$E$",E,(-1,-1, 1)); label("$F$",F,( 0, 1, 0)); label("$G$",G,(-1,-1, 1)); label("$H$",H,( 1,-1, 1)); label("$H'$",H1,(-1,-1, 1)); [/asy]
Let's put the polyhedron onto a coordinate plane. For simplicity, let the origin be the center of the square: $A(-6,6,0)$, $B(-6,-6,0)$, $C(6,-6,0)$ and $D(6,6,0)$. Since $ABFG$ is an isosceles trapezoid and $CDE$ is an isosceles triangle, we have symmetry about the $xz$-plane.
Therefore, the $y$-component of $E$ is 0. We are given that the $z$ component is 12, and it lies over the square, so we must have $E(2,0,12)$ so $CE=\sqrt{4^2+6^2+12^2}=\sqrt{196}=14$ (the other solution, $E(10,0,12)$ does not lie over the square). Now let $F(a,-3,b)$ and $G(a,3,b)$, so $FG=6$ is parallel to $\overline{AB}$. We must have $BF=8$, so $(a+6)^2+b^2=8^2-3^2=55$.
The last piece of information we have is that $ADEG$ (and its reflection, $BCEF$) are faces of the polyhedron, so they must all lie in the same plane. Since we have $A$, $D$, and $E$, we can derive this plane.* Let $H$ be the extension of the intersection of the lines containing $\overline{AG}, \overline{BF}$. It follows that the projection of $\triangle AHB$ onto the plane $x = 6$ must coincide with the $\triangle CDE'$, where $E'$ is the projection of $E$ onto the plane $x = 6$. $\triangle GHF \sim \triangle AHB$ by a ratio of $1/2$, so the distance from $H$ to the plane $x = -6$ is \[\sqrt{\left(\sqrt{(2 \times 8)^2 - 6^2}\right)^2 - 12^2} = 2\sqrt{19};\] and by the similarity, the distance from $G$ to the plane $x = -6$ is $\sqrt{19}$. The altitude from $G$ to $ABCD$ has height $12/2 = 6$. By similarity, the x-coordinate of $G$ is $-6/2 = -3$. Then $G = (-6 \pm \sqrt{19}, -3, 6)$.
Now that we have located $G$, we can calculate $EG^2$:
\[EG^2=(8\pm\sqrt{19})^2+3^2+6^2=64\pm16\sqrt{19}+19+9+36=128\pm16\sqrt{19}.\] Taking the negative root because the answer form asks for it, we get $128-16\sqrt{19}$, and $128+16+19=\fbox{163}$.


One may also do this by vectors; $\vec{AD}\times\vec{DE}=(12,0,0)\times(-4,-6,12)=(0,-144,-72)=-72(0,2,1)$, so the plane is $2y+z=2\cdot6=12$. Since $G$ lies on this plane, we must have $2\cdot3+b=12$, so $b=6$. Therefore, $a=-6\pm\sqrt{55-6^2}=-6\pm\sqrt{19}$. So $G(-6\pm\sqrt{19},-3,6)$.