|Online MIPT programming contest||РУССКИЙ|
Time limit = 5 secondsCorrect dictionary consists of definitions which use only correctly defined terms or axiomatic terms.
Correct dictionary should not have "cyclic definitions".
Correct dictionary should not have more than one definition of one term.
You are to determine whether input dictionary is correct.
Input First line of input contains the number of definitions D < 1000. Then D lines follow. Each line begins with defined term. Then number Ni < 20 of terms used in it's definition and terms themselves folow. Term length less than 20 letters.
Output Output should contain one line with word "CORRECT" or "NOT CORRECT".
2 aaa 3 bbb ccc ddd bbb 1 ccc
2 think 2 mind intellect mind 1 think
2 aaa 1 a aaa 2 c d
31 May 2003
© acm.mipt DevGroup
The page was generated in 190ms