Solving the public headquarters problem