Hide

Problem D
Haiku

A haiku is a Japanese form of poetry. It consists of three phrases of $5$, $7$ and $5$ syllables each.

Once a year, HiQ has a haiku contest, where employees submit their best poems. The poems are then judged based on a wide range of aspects, such as

  • creativity

  • simplicity

  • beauty

  • whether the poem is actually a haiku

This last point turned out to be quite a challenge for the judges (many problems arose when half the judges indexed syllables starting at $0$ and the other half at $1$).

Can you help the judges to determine whether a submitted poem is a haiku, given a set of syllables? Note that there may exist multiple decompositions of a single word in the poem into syllables. In this case, you should determine whether some decomposition is a haiku.

Input

The first line of input contains a single integer $1 \le S \le 100$, the number of syllables. The next line contains $S$ words separated by spaces (the syllables). Each syllable contains at most $7$ lowercase letters a-z.

Then, three lines containing the poem follow. Each line contains a (non-empty) list of words separated by spaces, representing a phrase. The words contain only lowercase letters a-z. The length of each line is at most $100$ characters (including spaces).

It is guaranteed that there exists at least one decomposition of the poem into the given syllables.

Output

Output “haiku” if the given poem is a haiku, and “come back next year” otherwise (without the quotes).

Explanation of Sample Input 1

One possible decomposition into a haiku is:

spe-lling ve-ry hard
ear-ly in mor-ning ti-red
i need cov-fe-fe

Explanation of Sample Input 3

No matter how the third line is decomposed, it contains $8$ syllables instead of $5$, so it can not be a haiku.

Sample Input 1 Sample Output 1
20
va
fi
ve
mor
lling
spe
in
i
sh
ti
hard
cov
ear
fe
red
ja
ry
need
ly
ning
spelling very hard
early in morning tired
i need covfefe
haiku
Sample Input 2 Sample Output 2
22
q
c
da
plus
to
the
e
thee
un
late
ci
a
shall
by
com
i
ru
pare
temp
ble
hi
de
shall i compare thee
to a c plus plus template
undecidable
haiku
Sample Input 3 Sample Output 3
19
ju
win
soft
it
east
sun
and
light
der
the
is
through
li
but
yon
what
breaks
et
dow
but soft what light through
yonder window breaks it is
the east and juliet is the sun
come back next year

Please log in to submit a solution to this problem

Log in