Solution by Jo Christian Oterhals