Solution for tasks 20, 21, 22 added