The observer and the tops of the building and flagstaff are all at the same height of 30 m, meaning the top of the flagstaff is level with the observer. Using the property of equal angles subtended by objects of different heights from a parallel line, the horizontal distance x is given by the formula x squared equals h1 multiplied by h2. Here, the height of the building above the observer is 25 m and the height of the flagstaff is 5 m, so x squared equals 25 multiplied by 5, which is 125. Taking the square root gives a distance of 5 times the square root of (3 divided by 2).