A rabbit is smaller than a person, so it carries only 22 pairs of chromosomes. A rabbit chromosome is written with eight letters: p, i, n, k, h, a, r, e. A rabbit training school wants to give every rabbit an identification code, but its database accepts a code of ten letters only. The administrator therefore takes ten consecutive letters of a chromosome as the code.
For example, the chromosome of 44 letters pinkh areha harea rhear parer arehe irike anear park (written in groups of five for readability) yields 35 codes: pinkhareha, inkharehah, nkharehaha, and so on up to eanearpark.
Rabbits keep arriving, so the school needs a program that answers whether a code the administrator types is usable, meaning that exactly one rabbit matches it. The program handles two commands: register a new rabbit, and check a code.
A rabbit matches a code when the code appears as ten consecutive letters of its chromosome. If the code appears at several positions of one rabbit, that rabbit still counts once. Every register command registers one new rabbit, so two register commands carrying the same 44 letters are two different rabbits. Each test case starts with no rabbit registered.
The first line contains the number of test cases T (1≤T≤8).
Each test case begins with a line holding the number of commands Q (1<Q≤15000), followed by Q lines with one command each. A command of 44 letters registers a rabbit whose chromosome is that string. A command of 10 letters checks that code. Every letter is one of p, i, n, k, h, a, r, e.
For each check command, print one line: