A plane \( E \) is perpendicular to the two planes \( 2x-2y+z=0 \) and \( x-y+2z=4 \), and passes through the point \( P(1,-1,1) \). If the distance of the plane \( E \) from the point \( Q(a,a,2) \) is \( 3\sqrt{2} \), then \( (PQ)^{2} \) is equal to: