Let the height of the temple be AB = 126 m
Let the distances of two men from the base of the temple be
BC = x m and BD = y m respectively.

Then, in Δ ABC, tan 30° = \(\frac{AB}{BC} = \frac{126}{x}\)
⇒ \(\frac{1}{\sqrt3}=\frac{126}{x}\)
⇒ x = 126√3 m
In Δ ABD, tan 60° = \(\frac{AB}{BD} = \frac{126}{y}\)
⇒ \(\sqrt3 = \frac{126}{y}\) ⇒ y = \(\frac{126}{\sqrt3}\times\frac{\sqrt3}{\sqrt3}=\frac{126\sqrt3}{3}\) m = 42√3 m
∴ Required distance = x + y = 126√3 m + 42√3 m = 168√3 m.