The Starflyer Agents 

Famed investigator Paula Myo, working on behalf of the 2011 established Commonwealth government, is determined to stop the Starflyer from spying. The Starflyer is a ``human-friendly'' and powerful alien sentinel intelligence that was found by a space exploration frigate in the Dyson Alpha solar system in year 2285. It is not clear what the Starflyer's real intentions are towards the Commonwealth ... so, it is always better to be safe than sorry!!!


The Starflyer has the ability to control technological equipment; it typically infiltrates droids and uses them as agents. As a matter of fact, droids are carefully identified and tracked in the Commonwealth. Every droid has a history of software updates and each software update is tagged with a hash. A hash is a term built recursively from variable, constant, and function symbols as follows:

As a security measure, a well-kept secret from the general population, the Commonwealth enforces the following policy on droid software updates: for each droid, the tags of any software updates must be compatible. Two hashes h1 and h2 are compatible if there is a mapping $ \theta$ from variables to hashes such that h1$ \theta$ = h2$ \theta$, where h1$ \theta$ (resp., h2$ \theta$) denotes the simultaneous replacement of any occurrence of each variable x in h1 (resp., h2) with the hash $ \theta$(x). A sequence of hashes h1,..., hn is compatible if there is $ \theta$ such that h1$ \theta$,..., hn$ \theta$ are all equal.


For example, assume that X, Y, Z are variables, c, d are constants, and f, g are function symbols, and consider the hashes h1, h2, and h3 as follows:

h1 : f (X, g(c))        h2 : f (f (Y), Z)        h3 : f (c, g(Y, d ))

Observe that h1 and h2 are compatible because the mapping $ \theta$ = {X $ \mapsto$ f (Y), Z $ \mapsto$ g(c)} satisfies h1$ \theta$ = h2$ \theta$. However, any other pair from h1, h2, and h3 is not compatible. Therefore, any sequence of hashes containing h1, h2, and h3 is not compatible because there is no mapping $ \theta$ such that h1$ \theta$ = h2$ \theta$ = h3$ \theta$.


Detective Myo has just been briefed on the aforementioned security policy. She strongly believes that the Starflyer infiltrates the droids via software updates without having any knowledge of the security policy. If her intuition is right, then this is the chance to detect and stop some Starflyer agents. You have been assigned to Myo's team: your task is to write an algorithm for determining if a sequence of hashes is compatible or not.


Can you help Detective Myo to uncover the Starflyer agents?

Input 

The input consists of several test cases. The first line of each test case contains a string name and a natural number n separated by a blank ( 2 $ \leq$ n $ \leq$ 20, 1 $ \leq$ | name| $ \leq$ 16). Then n lines follow, each containing a hash hi ( 1 $ \leq$ i $ \leq$ n, 1 $ \leq$ | hi| $ \leq$ 512). You can suppose that:

The last test case is followed by a line with the text ``END 0''.

Output 

For each test case, a line must be printed. If the sequence of hashes h1,..., hn is compatible, then print the line


analysis inconclusive on XXX


or if the sequence of hashes h1,..., hn is not compatible, then print the line


XXX is a Starflyer agent


where XXX corresponds to name in the test case.

Sample Input 

r2d2 3
f(X,g(c))
f(f(Y),Z)
f(c,g(Y,d))
c3po 2
f(X,g(c))
f(f(Y),Z)
PC2 2
f(f(Y),Z)
f(c,g(Y,d))
END 0

Sample Output 

r2d2 is a Starflyer agent
analysis inconclusive on c3po
PC2 is a Starflyer agent