The Diligent Cryptographer

No attempts yetTime limit1sMemory limit256 MB

Problem

Halvor runs the single sign-on (SSO) login system at Identity Directories, Inc. For years he has told anyone who would listen that the encrypted login backend from Trustworthy Enterprises (TE) makes user authentication simpler and safer. Last week TE sent out a newsletter about their new Open Trust Protection (OTP) system. OTP went live recently and already covers new accounts and every user who changed a password in the last month.

In the old system a user's cryptographic key was a permutation of the first few letters of the alphabet, repeated many times so that it covered long messages. In the new system the key is random letters produced by a lava lamp based sub-contractor.

For example, BCAEDBCAEDBCAED was a possible key in the old system, because it repeats BCAED, a permutation of the letters A to E. BCDBCD and BABBABBABBAB were not possible: the repeated block BCD has no A, and BAB is not a permutation of AB because it has two Bs.

Halvor wants to replace the keys of the users who have not been moved to the new system automatically. He can read and write every key of his own users, and he hired you to write a program that decides which users need an update. To keep private data out of your hands, you only get the user names, the last login times, and at most the first 1000 letters of each key.

So for a key from the old system the string you receive may stop in the middle of a repetition, but its first letter is the start of a permutation. For a key from the new system the whole string is random, including the letters you receive.

Input

The first line contains one number TT, the number of test cases. Each test case is one line with a string KK, the first part of a user's cryptographic key.

  • 1T10001 \le T \le 1000
  • 1K10001 \le |K| \le 1000
  • Every letter in the input string is uppercase (clarification)
  • The entropy can be written as H(X)=i=1np(xi)logb(xi)H(X) = -\sum_{i=1}^{n} p(x_i) \log_b(x_i), where pp is the probability mass function of XX.

Output

For each test case, print one line: old if KK definitely comes from the old system, new if KK definitely comes from the new system, or unknown if the given part of the key does not settle it.