solution to the 3 houses problem