Solution by Laurent Rosenfeld
