Binary Code

Each of n binary words has at most one unreadable bit; decide whether the ?s can be filled so no word is a prefix of another.

Hard8TrieGreedyStringDFSNo attempts yetTime limit2sMemory limit2048 MB

Problem

Ben has just learned about binary prefix codes. A binary code is a set of nn distinct nonempty code words sis_i, each made of 0s and 1s. A code is a prefix code if for every iji \ne j, sis_i is not a prefix of sjs_j and sjs_j is not a prefix of sis_i. A word xx is a prefix of a word ww if there is a word yy, possibly empty, with xy=wxy = w. For example, x=11x = 11 is a prefix of w=110w = 110, and x=0100x = 0100 is a prefix of w=0100w = 0100.

Ben found a paper with nn lines of binary code on it. The paper is old, so some of the characters cannot be read. Each word contains at most one unreadable character.

Decide whether these nn lines can represent a binary prefix code. That is, decide whether Ben can replace every unreadable character with 0 or 1 so that the whole set becomes a prefix code.

Input

The first line contains the number of code words nn (1n5×1051 \le n \le 5 \times 10^5).

Each of the next nn lines contains one code word record. A record is nonempty and consists of the characters 0, 1 and ?, where ? stands for an unreadable character. Every record contains at most one ?.

The total length of the records does not exceed 5×1055 \times 10^5.

Output

Print YES on the first line if every ? can be replaced by 0 or 1 so that the words form a prefix code, and NO otherwise. Do not print the completed code words.