Implementation of the problem 19