input_file = 'C:\\users\\admin\\documents\\input.txt'
with open(input_file, 'r') as file:
for line in file:
if all([raiting[-1] == '5' for raiting in line[line.index('{') + 1:line.index('}')].split(', ')]):
print(line[:line.index('=')].strip())
Ivanon = {math:4, english:4, physic:4, chemistry:4, biology:4}
Petrov = {math:4, english:5, physic:4, chemistry:5, biology:4}
Sidorov = {math:5, english:5, physic:5, chemistry:5, biology:5}