Prefix - MarisaOJ: Marisa Online Judge

Prefix

Time limit: 1000 ms
Memory limit: 256 MB
Given $n$ string $S_1, S_2,...,S_n$. Determine if there exists 2 distinct indices $i, j$ that $S_i$ is a prefix of $S_j$. ### Input - The first line contains an integer $n$. - The next $n$ lines, each line contains a string. ### Output - Print the `YES` if there exists satisfied indices, `NO` otherwise. ### Constraints - $1 \le n \le 10^5$. - $1 \le |S_i| \le 20$. - $S_i$ contain only lowercase letters. ### Example Input: ``` 3 reimu marisa mari ``` Output: ``` YES ```