Second task completely new

Completely new solution for the second task