def next_line(F):
line = F.readline().strip()
if line.find("%%EOF") == 0:
return None
elif (line == '') or (line.find('%') == 0):
return next_line(F)
else:
return line
def parse(filename):
with open(filename) as F:
while True:
line = next_line(F)
ZGVmIG5leHRfbGluZShGKToKICAgIGxpbmUgPSBGLnJlYWRsaW5lKCkuc3RyaXAoKQoKICAgIGlmIGxpbmUuZmluZCgiJSVFT0YiKSA9PSAwOgogICAgICAgIHJldHVybiBOb25lCiAgICBlbGlmIChsaW5lID09ICcnKSBvciAobGluZS5maW5kKCclJykgPT0gMCk6CiAgICAgICAgcmV0dXJuIG5leHRfbGluZShGKQogICAgZWxzZToKICAgICAgICByZXR1cm4gbGluZQoKZGVmIHBhcnNlKGZpbGVuYW1lKToKICAgIHdpdGggb3BlbihmaWxlbmFtZSkgYXMgRjoKICAgICAgICB3aGlsZSBUcnVlOgogICAgICAgICAgICBsaW5lID0gbmV4dF9saW5lKEYpCg==