Жишээ тэстүүд

Оролт
3 1 2
112
2 2 3 1
1 1 3 8
2 1 2 1
Гаралт
NO
YES
Оролт
6 2 3
334934
2 2 5 2
1 4 4 3
2 1 6 3
1 2 3 8
2 3 6 1
Гаралт
NO
YES
NO

Тэмдэглэл

In the first sample test two checks will be made. In the first one substring "12" is checked on whether or not it has period 1, so the answer is "NO$". In the second one substring "88", is checked on whether or not it has period 1, and it has this period, so the answer is "YES$".

In the second statement test three checks will be made. The first check processes substring "3493", which doesn't have period 2. Before the second check the string looks as "334334", so the answer to it is "YES$". And finally, the third check processes substring "8334", which does not have period 1.