solutions/max_kaskevich/4/sources/4_5: refactoring magic iterator.