Toastmaster
According to those familiar with the renowned Soviet mathematician Ilya Nestorovich Vekua, he was known to be an engaging conversationalist and an excellent toastmaster.
One way to evaluate the effectiveness of a feast leader is through the toasting coefficient. This coefficient for a feast is defined as the minimum of the individual coefficients of all participants. An individual's coefficient is determined by the number of toasts in which they were mentioned as an object throughout the feast. For instance, at a birthday celebration, a participant who is a friend of the birthday person will be included in a toast for the birthday person's friends. If this participant is also a classmate, they will be included in a toast for classmates, assuming such a toast is made.
It is rumored that there was once an All-Union Federation of Feast Conducting based in Sighnaghi (Georgia, Kakheti). To earn the title of All-Union Category Toastmaster, one had to conduct 3 qualified feasts with a toasting coefficient of at least 2. The federation also awarded the title of Republican Category Toastmaster for conducting 5 qualified feasts with a toasting coefficient of at least 3. There are no known standards for achieving the title of Kakheti Category Toastmaster.
Given the data about the toasts made during a specific feast, your task is to determine if the toastmaster earned a score towards an honorary title and, if so, which category the score corresponds to.
Input
The first line of the input file contains two integers: 1 ≤ n ≤ 25 and 2 ≤ m ≤ 10^8. These represent the number of toasts made by the toastmaster and the total number of participants at the feast, respectively. Following this, there are n lines. If the first character of the i-th line is +, the line lists the numbers of participants included in the i-th toast. If the first character is -, it lists the numbers of participants excluded from the i-th toast. The sign is separated from the first number by a space. Participants are numbered from 1 to m. If a 0 follows the sign, it indicates that no participants were mentioned in the toast (in the case of + 0) or all participants were mentioned (in the case of - 0). Each line in the input file does not exceed 1000 characters.
Output
Print NO if the toastmaster did not earn a score for any honorary title. Print TUK if the toastmaster earned a score for the All-Union Category Toastmaster title. Print TRK if the toastmaster earned scores for both the All-Union Category Toastmaster and the Republican Category Toastmaster titles.