#include <bits/stdc++.h>
using namespace std;
void reloc() {
  freopen("cards.in", "r", stdin);
  freopen("cards.out", "w", stdout);
}
const int inf = 2e9, maxn = 5e5;
int m[maxn + 1], c[maxn + 1];
pair<int, int> cons[maxn + 1];
int n, k;
vector<int> g[maxn + 1];
bool ok[maxn + 1];
multiset<int> s, cave;
int v[maxn + 1], sizv;
struct block {
  int i;
  vector<int> v;
  bool operator<(const block b) const { return c[i] < c[b.i]; }
} bl[maxn + 1];
void read() {
  scanf("%d", &n);
  int u, v;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
    bl[i].i = i;
  }
  for (int i = 1; i <= n - 1; i++) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  scanf("%d\n", &k);
  for (int i = 1; i <= k; i++) {
    scanf("%d", &m[i]);
  }
  for (int i = k + 1; i <= n; i++) m[i] = 0;
  k = n;
}
pair<int, int> upd(pair<int, int> a, int b) {
  if (c[b] < c[a.first]) {
    a.second = a.first;
    a.first = b;
  } else if (c[b] < c[a.second])
    a.second = b;
  return a;
}
void dfs(int u, int p) {
  cons[u] = upd(cons[p], u);
  bl[cons[u].first].v.push_back(u);
  for (auto v : g[u])
    if (v != p) dfs(v, u);
}
bool OK(int va, int i) {
  sizv = 0;
  for (int j = 0; j <= (int)bl[i].v.size() - 1; j++) {
    v[sizv++] = (min(va, c[cons[bl[i].v[j]].second]));
  }
  sort(v, v + sizv);
  int j = 0;
  for (int a : s) {
    if (j == sizv) return 0;
    if (a > v[j++]) return 0;
  }
  return 1;
}
int getans(int i) {
  int l = c[bl[i].i], r = 1e9 + 1;
  while (l != r) {
    int mid = (l + r) >> 1;
    if (OK(mid, i))
      r = mid;
    else
      l = mid + 1;
  }
  if (r == 1e9 + 1) return inf;
  return max(0, l - c[bl[i].i]);
}
void work() {
  c[0] = inf;
  cons[0] = pair<int, int>(0, 0);
  dfs(1, 0);
  sort(bl + 1, bl + 1 + n);
  sort(m + 1, m + 1 + n);
  int st = 0;
  for (int i = 1; i <= n; i++) {
    st += bl[i].v.size();
    ok[i] = 1;
    if (m[st] > c[bl[i].i]) {
      for (int j = i + 1; j <= n; j++) {
        ok[j] = 0;
      }
      break;
    }
  }
  int ans = inf;
  int tt = n;
  for (int i = n; i > 0; i--) {
    for (int j = 0; j <= (int)bl[i].v.size() - 1; j++) {
      s.insert(m[tt--]);
    }
    for (auto it = cave.begin(); it != cave.end();) {
      auto m = s.upper_bound(*it);
      if (m != s.begin()) {
        cave.erase(it++);
        m--;
        s.erase(m);
      } else
        it++;
    }
    if (s.size() <= bl[i].v.size() && ok[i]) {
      ans = min(ans, getans(i));
    }
    for (int j = 0; j <= (int)bl[i].v.size() - 1; j++) cave.insert(c[bl[i].i]);
  }
  if (ans != inf)
    printf("%d\n", ans);
  else
    printf("-1\n");
}
int main() {
  read();
  work();
  return 0;
}
