Complex task

Took more than 15 minutes to solve the puzzle