Stephen Wolfram describes one dimensional cellular automata in his book "A New Kind of Science". The squares sit in a row and each square is either black or white. A new row is built from the previous row alone. The next color of a square comes from three squares of the previous row: the square itself and its two neighbors.
Three squares give eight color combinations. Take black as 1 and white as 0, multiply the left square by 4, the middle square by 2 and the right square by 1, then add them to get a position number. Write the rule number in binary. If the bit at that position is 1, the middle square becomes black on the next step, and if it is 0 the middle square becomes white. Rule numbers run from 0 to 255.
| Three squares of the previous row (left middle right) | Position | Middle square on the next step |
|---|---|---|
| BBB | 7 | bit 7 of the rule number |
| BBW | 6 | bit 6 of the rule number |
| BWB | 5 | bit 5 of the rule number |
| BWW | 4 | bit 4 of the rule number |
| WBB | 3 | bit 3 of the rule number |
| WBW | 2 | bit 2 of the rule number |
| WWB | 1 | bit 1 of the rule number |
| WWW | 0 | bit 0 of the rule number |
254 in binary is 11111110, so rule 254 gives white only when all three squares are white and gives black in the other seven cases. Start from a row whose middle square alone is black and apply rule 254 over and over, and a black triangle grows.
Unlike the automata in "A New Kind of Science", the automata in this problem move inside a bounded space.
For every line of input, find every one of the 256 rules that produces that row within the given maximum step number, starting from the standard start state. If no rule produces it, print NONE. If several rules produce it, print all of them in the output format below.
LINE 2 (15,8)(158,11) or LINE 4 NONE.