In Wonderland, there are N cities (enumerated from 1 to N) connected by bidirectional roads. Every city has an associated happiness score related to it.
Mike starts from the capital city, , and can only travel from to , if the two cities are directly connected through a road. The happiness of the city, , is added to Mike's own happiness when he travels through the city. He can skip any number of cities while traveling, but that would reset his happiness to 0 (that is, when Mike skips some city, his happiness is set back to 0). Once visited or skipped, he would not be able to visit or skip that city again. Mike wants to find the maximum happiness that can be achieved during his tour. Initially, Mike's happiness is zero.
Your task is to calculate the maximum happiness that Mike can achieve during his tour.
Input Format
The first line contains an integer T, denoting the number of test cases.
For each testcase :
The first line contains an integer N, denoting the number of cities.
The second line contains N space-separated integers, the i-th of which is , denoting city has happiness score .
The third line contains M, the number of roads.
The fourth and fifth lines contain space-separated integers, the of which is and respectively. They denote that there is a bidirectional road between and .
Input Constraints
It is guaranteed that any city can be reached from any other city.
Output Format
For each test case, print the maximum amount of happiness that Mike can achieve.
Answer for each test case should come in a new line.
First testcase :
Mike will skip City 1 and travel to City 2 which increases Mike's happiness to 2.
Second testcase :
Mike will skip City 1 and travel to City 3, which increases Mike's happiness to 4 and then he travels to City 6, which increases Mike's happiness to 9.