Joint Password Storage

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Johnny is the developer of Joint Password Storage (JPS). Storing passwords in plaintext is a bad idea. JPS splits each password into several parts and stores them separately.

A password is a string consisting of digits and English letters. Bitwise XOR of all parts should be equal to the password. To attract less attention, Johnny decided that each part should look like something ordinary, like an arithmetic equality. What could be more ordinary than things like "2+2=42+2=4"? 

Formally, a valid split of a password is a set of correct arithmetic equalities of the same length as the password, for which bitwise XOR of ASCII codes of characters on each position is equal to the ASCII code of the corresponding password character. A correct arithmetic equality is a string described by the following grammar, with both expressions evaluating to the same value. Operator precedence is standard: expressions in brackets of any type take precedence over all other operations, multiplication takes precedence over addition and subtraction, and operators with the same level of precedence are evaluated from left to right.

  • equality\langle equality \rangle ::= expression\langle expression \rangle '=' expression\langle expression \rangle
  • expression\langle expression \rangle ::= term\langle term \rangle | expression\langle expression \rangle '+' term\langle term \rangle | expression\langle expression \rangle '-' term\langle term \rangle 
  • term\langle term \rangle ::= multiplier\langle multiplier \rangle | term\langle term \rangle '*' multiplier\langle multiplier \rangle
  • multiplier\langle multiplier \rangle ::= number\langle number \rangle | '(' expression\langle expression\rangle ')' |  '[' expression\langle expression\rangle ']' | '{' expression\langle expression \rangle '}'
  • number\langle number \rangle ::= '0'   \ \vert\ ( '1' | ... | '9' ) (( '0' | ... | '9' )\*)^\*

For your convenience, ASCII codes of all related characters are provided below:

()*+-0-9=A-Z[]a-z{}
404142434548-576165-90919397-122123125

Your task is to write a splitting module which converts a password into bitwise XOR of several correct arithmetic equalities.

입력

The first line contains a single integer PP (1P501 \le P \le 50) --- the number of passwords to split. Each of the next PP lines contains a single string --- password ss (10s5010 \le |s| \le 50). Passwords can contain digits and both lowercase and uppercase English letters.

출력

For each password, if there is no valid split, output a line with a single word "NO".

Otherwise, the first line should contain a single word "YES". The next line should contain one integer kk (1k10001 \le k \le 1000) --- the number of equalities in your split. Each of the next kk lines should contain one equality. It can be proven that if a solution exists, there is a solution where kk doesn't exceed 1000.