|Time limit : 1 s||Memory limit : 32 mb|
|Submitted : 89||Accepted : 56|
There was a public bus transport in one town. All buses had circular lines. Each line had at least two stops. Some lines had some stops in common. When two or more bus drivers met on some stop they announced each other all news they knew, so that after leaving the stop they all knew the same news. All drivers started driving their buses at the same time and at this time each driver knew some news that was not known to any other driver. Each bus ran all the time along a fixed bus line. Different buses running along the same bus line started possibly on different stops of the bus line at the beginning.
The operation of buses was highly synchronized. The time necessary to get from one stop to next stop was equal for all stops and all lines.
There were n lines ( 0 < n < 20), d drivers (and also d buses) ( 0 < d < 30) numbered by integers from 1 to d, and s bus stops ( 0 < s < 50) numbered by integers from 1 to s.
The drivers' gossiping club would like to know whether each driver, in some time, would learn all news from his colleagues. Write a program that will answer this question.
2 3 5 1 2 3 1 1 2 2 2 3 4 5 2 3 0 0 0