Medicine

Time Limit: 16000/8000MS (Java/Others) Memory Limit: 256000/128000KB (Java/Others)

Problem Description



 

Input

Output

Sample Input

4
2 2
2 3
3 2
1 1 1
3 3
1 1 1
3 3
1 2 2

Sample Output

1
1
0
Impossible

Source

buaads

Manager

Information
Solved Number36
Submit Number223
Problem Tags
dfs and similar
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel