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.