409081: GYM103430 N Haiku
Description
A haiku is a Japanese form of poetry. All haiku poems follow a distinct pattern: they consist of three phrases — the first phrase has $$$5$$$ syllables, the second phrase has $$$7$$$ syllables and the third phrase has $$$5$$$ syllables.
Phonetic nuances aside, let's consider each vowel in a phrase a single syllable. Thus, a phrase contains as many syllables as vowels.
From that, there arises a classic argument of what is considered a vowel. Letters A, E, I, O, U are vowels for sure (regardless of being lowercase or uppercase). Letter Y, however... Let's say that it can be both vowel or consonant, and you are free to decide which one you want it to be each time it appears in the phrase. All other letters are consonants.
You want to check if the given three phrases can fit into the haiku format. That is if it's possible to call every letter Y in them a vowel or a consonant in such a way that the number of syllables in the phrases is $$$5-7-5$$$.
InputThe first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of testcases.
Then the descriptions of $$$t$$$ testcases follow.
The first line of the testcase contains three integers $$$n_1, n_2, n_3$$$ ($$$1 \le n_i \le 50$$$) — the number of words in the $$$i$$$-th phrase. A word is a sequence of lowercase and uppercase Latin letters.
The $$$i$$$-th of the next three lines contains the $$$i$$$-th phrase: $$$n_i$$$ words, separated by a single space. The first and the last characters of the phrase are always letters. The length of each phrase doesn't exceed $$$100$$$.
OutputFor each testcase print "YES" if it's possible to call every letter Y in the given three phrases a vowel or a consonant in such a way that the number of syllables in the phrases is $$$5-7-5$$$. Otherwise, print "NO".
ExampleInput7 3 4 4 Rainy and cold On the programming contest Think of the tree 4 5 3 That reminds me of How I became a cf Master on Monday 4 6 5 Buy it use it Break it fix it trash it Change it mail upgrade it 2 5 3 Today things Well known in China are Well known globally 2 4 3 Seems interesting I will definitely try To implement it 2 3 4 U lukomorya dub zelenyy Zlataya cep na dube tom 3 9 3 I dont understand why why why why oh why why why why thats a haikuOutput
YES NO NO NO NO YES YES