Ping Ping Ping HDU-6203
The structure of the computer in Northeastern University is pretty miraculous. There is n servers, some servers connect to the gateway whose IP address is 0 directly. All servers is connected with each other by n netting twines. It is said the this structure are favorable for maintaining physical problem of servers.
But because of an unexpected rainstorm, the computer, is destroyed by a terrible thunderclap!
Our maintainer bittersweet found this many servers were not able to being visited, so he hurried to the computer Up the reason. After several hours, bittersweet realized the some net gape of servers were broken by Thunderclap. However, there were too many servers to find out all the broken net gapes quickly. So he came up with a idea to assess the damaged condition roughly. Bittersweet decided to turn on some servers and ping other servers randomly, then record the unsuccessful pairs of servers .
Now he need a program to analyze the record to confirm what's the minimum number of servers whose net gape was dest Royed by Thunderclap. Can you help him?
Inputthere is at the most test cases.
In each test case, the first line was an integer n (3≤n≤104, denoting the number of servers. The IP address of these servers is 1...N.
Then follows n lines, each line contains a integers u and V (0≤u,v≤n), denoting that the server wh The OSE IP address is U-connected with the server whose IP address was v by netting twine initially.
After those, there are one line contains only a integer p (p≤50000), denoting the number that bittersweet us Es Ping.
Then follows P lines, each line contains the integers u and V, denoting when using the server U to ping server V, it ret urned unsuccessful.
Outputa single integer xx in a line, denoting at least