#Q64. 「一本通 2.4 练习 5」病毒
「一本通 2.4 练习 5」病毒
Description
Original Source: POI 2000
The Binary Virus Review Committee recently discovered the following pattern: certain specific binary strings are virus codes. If a segment of code does not contain any virus code segment, it is considered safe. Now that the committee has identified all virus code segments, the question is: does there exist an infinitely long safe binary code?
Example: For instance, if are the virus code segments, then a possible infinitely long safe code could be . However, if are the virus code segments, then no infinitely long safe code exists.
Write a program that reads the virus codes and determines whether an infinitely long safe code exists, then outputs the result.
Input Format
The first line contains an integer , indicating the number of virus code segments;
The following lines each contain a non-empty string—each representing a virus code segment.
Output Format
The first line outputs a single word. If such a code exists, output TAK; otherwise, output NIE.
Sample 1
3
01
11
00000
NIE
Data Range and Hint
For all data, the total length of all virus code segments does not exceed .