A recursive acronym is an acronym (an abbreviation word formed from the first letter of words) that refer to itselft recursively. For instance, GNU stands for GNU not Unix.
In the community of computer science, there exists somewhat a tradition that quite a few people tend to choose such recursive acronym to express their humorousness, e.g. ATI stands for ATI Technology Incoperated (a graphic card manufacturer which was acquired by AMD and became Radeon later), TikZ stands for TikZ ist kein Zeichenprogramm (German; TikZ is not a drawing program, TikZ is a LaTeX package to draw vector graphics), and so forth.
In this problem, your task is to determine whether some words can form a typical recursive acronym refering to the first word.
This problem is case-insensitive, i.e., it does not matter that a letter is lower case or upper case.
You could call getline() to get entire content including spaces of a line until the newline character, and use stringstream to split the line by spaces. For more detail, you may refer to online resources.
Each test case may contain several lines. For each line, please determine whether it can form a typical recursive acronym refering to its first word or not.
The number of lines won't exceed 10. Each line won't contain more than 1000 words. The length of words won't exceed 1000.
For each line, if it can form a typical recursive acronym refering to its first word, then print o'_'o, otherwise QQ. Remember to put a newline character.