#C3101. Maximum Data Transfer
Maximum Data Transfer
Maximum Data Transfer
You are given a network of planets, each storing an integer amount of data, and connected by bidirectional communication channels. Although these channels connect the planets, the maximum amount of data that can be transferred between any two planets is determined solely by the maximum data stored on a single planet.
Mathematically, for a test case with planets having data values \(d_1, d_2, \ldots, d_n\), the answer is:
\(\max\{d_1, d_2, \ldots, d_n\}\)
Your task is to compute this maximum value for each test case.
inputFormat
The input is given via stdin and has the following format:
- The first line contains a single integer \(t\) representing the number of test cases.
- For each test case:
- An integer \(n\) denoting the number of planets.
- A line with \(n\) space-separated integers representing the data stored on each planet.
- An integer \(m\) representing the number of bidirectional communication channels.
- \(m\) subsequent lines, each containing two space-separated integers \(u\) and \(v\), indicating a communication channel between planet \(u\) and planet \(v\).
outputFormat
For each test case, output a single line to stdout containing the maximum data that can be transferred, i.e. the maximum data value among the planets.
## sample3
4
8 10 5 15
3
1 2
1 3
3 4
3
6 6 6
2
1 2
2 3
5
1 3 2 4 2
4
1 2
1 3
3 4
4 5
15
6
4
</p>