Recursion. n. masc. see recursion.
Folklore
Petro is developing a new development environment for the language Ж±. He is currently working on a module to detect potential infinite recursion.
Ж± is a procedural language in which all variables are binary, meaning each variable can have either the value "" or "". Each procedure in Ж± can take several arguments. The language supports the following operators:
Increment operator "x++" – if is , it becomes ;
Decrement operator "x–" – if is , it becomes ;
Conditional operator "if (x) S1 else S2" where and are arbitrary operators; execute if is , or if is ;
Procedure call "f (x, y)";
Compound operator "{S1 S2 ...}" where , , etc., are arbitrary operators; execute , , etc., in this order.
A procedure is defined as: "<procedure name> (<argument list>) S" where S is an arbitrary operator.
All arguments are passed by value (that is, changes within the procedure do not modify the values of the corresponding variables in the calling procedure).
For example, the program in the first example contains a procedure "inc" which takes a three-bit value via three arguments x2, x1, and x0, and eventually calls the procedure "done" with three arguments representing the value incremented by one.
Given the program, determine whether it is possible to call some procedure with arguments such that the result is infinite recursion.
The input file contains a program written in the language Ж±. It contains at most procedures, each with at most arguments. The input file size does not exceed bytes. Procedure and argument names consist of letters and digits and are case-sensitive. All names are no longer than characters. No procedure is named "if" or "else".
Output "YES" if it is possible to call some procedure with arguments resulting in infinite recursion, otherwise output "NO".
Example 1