Python.The problem is in solving the problem with cycles

visit shbcf.ru