Solution by Simon Reinhardt
