#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
vector<int> m[500100], v;
priority_queue<pair<int, int> > q;
int u[500100], h[500100], a[500100], c[500100];
struct T {
  int s, m;
  T(int s = 0, int m = 0) : s(s), m(m) {}
};
T operator+(const T &a, const T &b) {
  if (!a.s) return b;
  if (!b.s) return a;
  return T(a.s + b.s, min(b.m, a.m + b.s));
}
T d[1 << 20];
void add(int i, int v) {
  i += (1 << 19);
  d[i].s += v;
  if (d[i].s)
    d[i].m = i - (1 << 19);
  else
    d[i].m = 0;
  for (i >>= 1; i; d[i] = d[2 * i] + d[2 * i + 1], i >>= 1)
    ;
}
void push(int i) {
  q.push(make_pair(h[i], i));
  u[i] = 1;
}
int bs(int l, int r, int x) {
  for (; l < r;) {
    int c = (l + r + 1) / 2;
    if (a[c - 1] <= x)
      l = c;
    else
      r = c - 1;
  }
  return r;
}
void dfs1(int i, int p, int v) {
  add(v, 1);
  for (int j = 0; j < m[i].size(); j++)
    if (!u[m[i][j]] && m[i][j] != p) dfs1(m[i][j], i, min(v, c[m[i][j]]));
}
void dfs2(int i, int p, int v, int u) {
  add(v, -1);
  add(u, 1);
  for (int j = 0; j < m[i].size(); j++)
    if (!::u[m[i][j]] && m[i][j] != p)
      dfs2(m[i][j], i, min(v, c[m[i][j]]), min(u, c[m[i][j]]));
}
int main() {
  int n, k, i, j;
  scanf("%d", &n);
  for (i = 0; i < n; scanf("%d", &h[i]), i++)
    ;
  for (k = n - 1; k--;
       scanf("%d%d", &i, &j), i--, j--, m[i].push_back(j), m[j].push_back(i))
    ;
  scanf("%d", &k);
  for (i = 0; i < k; scanf("%d", &a[i]), i++)
    ;
  sort(a, a + k);
  for (i = 0; i < n; c[i] = bs(0, k, h[i]), i++)
    ;
  for (push(0); !q.empty();) {
    if (!k) break;
    if (a[k - 1] > q.top().first) break;
    k--;
    i = q.top().second;
    q.pop();
    for (j = 0; j < m[i].size(); j++)
      if (!u[m[i][j]]) push(m[i][j]);
  }
  if (!k) {
    printf("0\n");
    return 0;
  }
  for (; !q.empty(); v.push_back(q.top().second), q.pop())
    ;
  for (i = 0; i < v.size(); dfs1(v[i], -1, c[v[i]]), i++)
    ;
  int z = 2000000000;
  for (i = 0; i < v.size(); i++) {
    dfs2(v[i], -1, c[v[i]], k);
    if (d[1].m >= k) z = min(z, a[k - 1] - h[v[i]]);
    dfs2(v[i], -1, k, c[v[i]]);
  }
  if (z == 2000000000) z = -1;
  printf("%d\n", z);
  return 0;
}
