Introduction - If you have any usage issues, please Google them yourself
Standard input will contain multiple data sets. Each data set consists two parts.
For the first part, the first line is an integer N, followed by N lines. Each line contains an integer Si(Si<=32768), representing
the power of each monkey.
For the second part, the first line is an integer M (M <= 100,000), meaning there were M times of conflicts. Then, M lines follow,
each line contains two integers x and y, which means the xth monkey has conflict with the yth monkey.