Solution to the 'Tic tac toe' puzzle