#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 2;
int n, k, res, A[N], B[N], Mn[N][2], P[N], M[N << 2], S[N << 2];
vector<int> U, Efc[N], Adj[N];
void DFS(int v, int p) {
  Mn[v][0] = min(Mn[p][0], A[v]);
  if (Mn[p][0] >= min(Mn[p][1], A[v]))
    Mn[v][1] = Mn[p][0], P[v] = v;
  else
    Mn[v][1] = min(Mn[p][1], A[v]), P[v] = P[p];
  for (auto &u : Adj[v])
    if (u != p) DFS(u, v);
  Efc[P[v]].push_back(v);
}
void Add(int le, int ri, int val, int id = 1, int l = 0,
         int r = (int)U.size()) {
  if (ri <= l || r <= le) return;
  if (le <= l && r <= ri) {
    S[id] += val;
    M[id] += val;
    return;
  }
  Add(le, ri, val, id * 2, l, (l + r) >> 1);
  Add(le, ri, val, id * 2 + 1, (l + r) >> 1, r);
  M[id] = min(M[id * 2], M[id * 2 + 1]) + S[id];
}
inline int Get(int val) {
  return ((int)(upper_bound(U.begin(), U.end(), val) - U.begin()) - 1);
}
inline bool Solve(int v, int c) {
  for (auto &u : Efc[v])
    Add(Get(Mn[u][0]) + 1, Get(min(Mn[u][1], A[v] + c)) + 1, 1);
  bool ret = (M[1] >= 0);
  for (auto &u : Efc[v])
    Add(Get(Mn[u][0]) + 1, Get(min(Mn[u][1], A[v] + c)) + 1, -1);
  return (ret);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &A[i]);
  for (int i = 1, v, u; i < n; i++)
    scanf("%d%d", &v, &u), Adj[v].push_back(u), Adj[u].push_back(v);
  scanf("%d", &k);
  for (int i = 0; i < k; i++) scanf("%d", &B[i]), U.push_back(B[i]);
  sort(U.begin(), U.end());
  U.resize(unique(U.begin(), U.end()) - U.begin());
  Mn[0][0] = Mn[0][1] = res = 1e9;
  DFS(1, 0);
  for (int i = 0; i < k; i++) Add(0, Get(B[i]) + 1, -1);
  for (int i = 1; i <= n; i++) Add(0, Get(Mn[i][0]) + 1, 1);
  for (int i = 1; i <= n; i++) {
    int le = -1, ri = res, md;
    if (!Solve(i, ri)) continue;
    while (ri - le > 1) {
      md = (le + ri) >> 1;
      if (Solve(i, md))
        ri = md;
      else
        le = md;
    }
    res = ri;
  }
  if (res == 1e9) return puts("-1");
  return !printf("%d", res);
}
