409315: GYM103483 I Wheel of Fortune

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Wheel of Fortunetime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

Katya's old dream to be in the "Wheel of Fortune" game has come true.

Let's remind the rules of the "Wheel of Fortune" game:

  • The goal of the game is to guess a word hidden by the game host. The contestants make turns by naming a letter.
  • If the named letter occurs in the hidden word, then the host opens all its occurrences in the word, and the contestant can name a new letter.
  • If the contestant names a letter that doesn't occur in the hidden word, the turn of the next contestant starts.

The host of the game hides the word of length $$$L$$$. Katya really wanted to win the game, so she hacked the game editor's computer. She found out that the hidden word will be one of $$$N$$$ words.

Katya has the first turn in the game. Help Katya to understand if she can guarantee to win the game. Is it true that Katya will be able to guess any word from the stolen list without loosing the turn?

Input

In the first line there are two integers $$$L$$$ and $$$N$$$ — the length of the hidden word and the number of stolen words ($$$1 \le L \le 10^6$$$, $$$1 \le N \le 10^5$$$).

In the next $$$N$$$ lines there are different words of length $$$L$$$. They consist of lowercase English letters.

It is guaranteed that the total length of all words does not exceed $$$10^6$$$.

Output

Output "YES", if Katya is able guarantee herself a win, otherwise output "NO".

ExamplesInput
5 2
hello
world
Output
YES
Input
4 4
idea
play
game
warm
Output
YES
Input
4 2
game
name
Output
NO
Note

In the first sample Katya can win, if she first names the letter "l". Seeing the opened letters, she can determine he hidden word.

In the third sample for all Katya's strategies there is a risk of naming a wrong letter and loosing the turn.

加入题单

上一题 下一题 算法标签: