Halvor is in charge of the Single Sign-On (SSO) login system for Identity Directories, Inc. He has been a passionate supporter of their technology for years, telling anyone who will listen how it makes user authentication simpler and more secure with the encrypted login backend provided by Trustworthy Enterprises (TE). Last week Halvor got a newsletter from TE, where they introduced their new and highly innovative Open Trust Protection (OTP) system, which was recently implemented and has been used for new accounts and users that changed their password in the last month.
Previously, a user’s cryptographic key consisted of a permutation of the first letters of the alphabet, repeated many times so it could be used for long messages. In the new improved system the cryptographic key instead consists of random letters generated by a lava lamp-based sub-contractor.
As an example the string
BCAEDBCAEDBCAED was a possible key in the old system since this is a repetition of
BCAED, which is a permutation of the letters from
E. The strings
BABBABBABBAB would not be possible, since the letter
A is missing from the repeated permutation
BAB is not a permutation of
AB since there are two
Halvor decides to change the keys for the users that have not already been automatically moved to the new system. Luckily he has read and write access to all the keys for his users, and has contracted you to write a program to determine which users need to be updated. To avoid any privacy concerns, you are only given a list of the user’s names, last login times and up to the first 1000 letters of their key.
Thus for the old system the end of the key substring you receive might be cut off in the middle of a repetition, but the first letter is guaranteed to be the start of a permutation. For the new system the entire string will be random, including the letters you receive.
The first line of input contains a single number T, the number of test cases to follow. Each test case consists of one line containing a string K, which is the first part of a user’s cryptographic key.
For each test case, output a line containing the line ”old” if K is definitely from the old system, ”new” if K is definitely from the new system, or ”unknown” if this cannot be determined from the provided key substring.
4 ABCD BB HELP IAMTRAPPEDINACRYPTOGRAPHICKEYFACTORY
unknown new unknown new