Solved second task