Introduced two versions of the solution