Time Limit: 1000 ms
Memory Limit: 65535 ms
Many years later , xiaoyoulei start up a big company，the company has a lot of rooms
layers of nested，it’s very beautiful，but it cause a problem that his staff are very easy to go wrong ways. what’s more ,once the door is locked , it’s easy to get lost.
The company layout like the picture below：
In order to make up for his failure design on the room layout , xiaoyoulei make a decision that he will select some keys just in the corresponding rooms .（the arc in the picture means there is a door，for example the arc between room 1 and room 2means there is a door . The room where the arc locates there has the key . if the door is open ，you can get in both of the room from the other one . But if the door is locked ，because Room 2 has the key to open the lock , so from room 2 you can get through to room 1. But if you are in the room 1. You won’t get through to room 2.）
Xiao you lei has some bad habit，that he likes to put valuables in one room of the company. To show off his wealthiness , he also told others which room the valuables are there.
Here comes the problem , there are thieves in the company!
Now ，if we could tell you the room numbers where the thieves are there and the room numbers where the valuables are . Could you tell me how many doors we must lock at least to prevent the thieves to steal the valuables in the room . if no matter how many doors were locked ,we can not prevent the thieves.（for example the thief is in room 3，the valuables are in room 2，than the thief can get the keys in room 3 to get in room 4, and get the key in room 4 to get in room 2. ），just call xiao you lei！
3 7 2 S 0 T 3 0 4 5 S 2 1 6 S 2 1 2 S 0 S 0 S 0 7 2 I 0 S 3 0 4 5 S 2 1 6 T 2 1 2 S 0 S 0 T 0 4 3 T 0 S 1 2 S 1 0 S 4 1 1 2 2