After more than 3 years of complete dominance, MineCraft Awesome Parodys has a new competitor:
- Each line must have the word
mine
and the wordcraft
at least once at some point. - The first occurrence of
mine
must come before the first occurrence ofcraft
in each line. - The number of non
mine
and noncraft
words should not exceed the number of timesmine
occurs.
Input Specification
The first line contains an integer , the number of lines in the Minecraft parody.
The next lines each contain a line from the minecraft parody. Each line will consist only of lowercase letters and space and will not exceed characters in length.
Note: For the purposes of this problem a word is defined as a collection of letters separated from other words by a space.
Output Specification
A single line containing either PROFIT
if the song is a Minecraft parody, or cri
otherwise.
Sample Input 1
2
welcome to my mine
we are mining diamonds
Sample Output 1
cri
Sample Input 2
1
minecraft
Sample Output 2
cri
Sample Input 3
2
my mine craft mine
yes i mine craft
Sample Output 3
PROFIT
Comments