Solution for yandex test task.