Solution to the traffic lights problem.