#include <bits/stdc++.h>
using namespace std;
template <typename T, bool maximum_mode = false>
struct RMQ {
  int n = 0, levels = 0;
  vector<T> values;
  vector<vector<int>> range_low;
  RMQ(const vector<T> &_values = {}) {
    if (!_values.empty()) build(_values);
  }
  static int largest_bit(int x) { return 31 - __builtin_clz(x); }
  int better_index(int a, int b) const {
    return (maximum_mode ? values[b] < values[a] : values[a] < values[b]) ? a
                                                                          : b;
  }
  void build(const vector<T> &_values) {
    values = _values;
    n = values.size();
    levels = largest_bit(n) + 1;
    range_low.resize(levels);
    for (int k = 0; k < levels; k++) range_low[k].resize(n - (1 << k) + 1);
    for (int i = 0; i < n; i++) range_low[0][i] = i;
    for (int k = 1; k < levels; k++)
      for (int i = 0; i <= n - (1 << k); i++)
        range_low[k][i] = better_index(range_low[k - 1][i],
                                       range_low[k - 1][i + (1 << (k - 1))]);
  }
  int query_index(int a, int b) const {
    assert(0 <= a && a < b && b <= n);
    int level = largest_bit(b - a);
    return better_index(range_low[level][a],
                        range_low[level][b - (1 << level)]);
  }
  T query_value(int a, int b) const { return values[query_index(a, b)]; }
};
struct LCA {
  int n = 0;
  vector<vector<int>> adj;
  vector<int> parent, depth, subtree_size;
  vector<int> euler, first_occurrence;
  vector<int> tour_start, tour_end, tour_list, postorder;
  vector<int> heavy_root;
  RMQ<int> rmq;
  LCA(int _n = 0) { init(_n); }
  LCA(const vector<vector<int>> &_adj) { init(_adj); }
  void init(int _n) {
    n = _n;
    adj.assign(n, {});
    parent.resize(n);
    depth.resize(n);
    subtree_size.resize(n);
    first_occurrence.resize(n);
    tour_start.resize(n);
    tour_end.resize(n);
    tour_list.resize(n);
    postorder.resize(n);
    heavy_root.resize(n);
  }
  void init(const vector<vector<int>> &_adj) {
    init(_adj.size());
    adj = _adj;
  }
  void add_edge(int a, int b) {
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  void dfs(int node, int par) {
    parent[node] = par;
    depth[node] = par < 0 ? 0 : depth[par] + 1;
    subtree_size[node] = 1;
    if (par >= 0)
      adj[node].erase(find(adj[node].begin(), adj[node].end(), par));
    for (int &child : adj[node]) {
      dfs(child, node);
      subtree_size[node] += subtree_size[child];
    }
    sort(adj[node].begin(), adj[node].end(),
         [&](int a, int b) { return subtree_size[a] > subtree_size[b]; });
  }
  int tour, post_tour;
  void tour_dfs(int node, bool heavy) {
    heavy_root[node] = heavy ? heavy_root[parent[node]] : node;
    first_occurrence[node] = euler.size();
    euler.push_back(node);
    tour_list[tour] = node;
    tour_start[node] = tour++;
    bool heavy_child = true;
    for (int child : adj[node]) {
      tour_dfs(child, heavy_child);
      euler.push_back(node);
      heavy_child = false;
    }
    tour_end[node] = tour;
    postorder[node] = post_tour++;
  }
  void build() {
    parent.assign(n, -1);
    for (int i = 0; i < n; i++)
      if (parent[i] < 0) dfs(i, -1);
    tour = post_tour = 0;
    for (int i = 0; i < n; i++)
      if (parent[i] < 0) {
        tour_dfs(i, false);
        euler.push_back(-1);
      }
    assert((int)euler.size() == 2 * n);
    vector<int> euler_depths;
    for (int node : euler)
      euler_depths.push_back(node < 0 ? node : depth[node]);
    rmq.build(euler_depths);
  }
  pair<int, int> find_farthest(int node, int par, int path) const {
    pair<int, int> current = {path, node};
    for (int neighbor : adj[node])
      if (neighbor != par)
        current = max(current, find_farthest(neighbor, node, path + 1));
    return current;
  }
  pair<int, pair<int, int>> get_diameter() const {
    int u = find_farthest(0, -1, 0).second;
    pair<int, int> farthest = find_farthest(u, -1, 0);
    int v = farthest.second;
    return {farthest.first, {u, v}};
  }
  int get_lca(int a, int b) const {
    a = first_occurrence[a];
    b = first_occurrence[b];
    if (a > b) swap(a, b);
    return euler[rmq.query_index(a, b + 1)];
  }
  bool is_ancestor(int a, int b) const {
    return tour_start[a] <= tour_start[b] && tour_start[b] < tour_end[a];
  }
  bool on_path(int x, int a, int b) const {
    return (is_ancestor(x, a) || is_ancestor(x, b)) &&
           is_ancestor(get_lca(a, b), x);
  }
  int get_dist(int a, int b) const {
    return depth[a] + depth[b] - 2 * depth[get_lca(a, b)];
  }
  int child_ancestor(int a, int b) const {
    assert(a != b);
    assert(is_ancestor(a, b));
    int child =
        euler[rmq.query_index(first_occurrence[a], first_occurrence[b] + 1) +
              1];
    assert(parent[child] == a);
    assert(is_ancestor(child, b));
    return child;
  }
  int get_kth_ancestor(int a, int k) const {
    while (a >= 0) {
      int root = heavy_root[a];
      if (depth[root] <= depth[a] - k) return tour_list[tour_start[a] - k];
      k -= depth[a] - depth[root] + 1;
      a = parent[root];
    }
    return a;
  }
  int get_kth_node_on_path(int a, int b, int k) const {
    int anc = get_lca(a, b);
    int first_half = depth[a] - depth[anc];
    int second_half = depth[b] - depth[anc];
    assert(0 <= k && k <= first_half + second_half);
    if (k < first_half)
      return get_kth_ancestor(a, k);
    else
      return get_kth_ancestor(b, first_half + second_half - k);
  }
};
const int INF = 1e9 + 5;
struct edge {
  int node = -1, weight = -1;
  edge() {}
  edge(int _node, int _weight) : node(_node), weight(_weight) {}
};
int N;
vector<vector<edge>> adj;
vector<int> dist;
vector<int> previous;
void bfs_check(queue<int> &q, queue<int> &next_q, int node, int from,
               int new_dist, int add) {
  assert(0 <= add && add <= 1);
  if (new_dist < dist[node]) {
    dist[node] = new_dist;
    previous[node] = from;
    (add == 0 ? q : next_q).push(node);
  }
}
void bfs(const vector<int> &source) {
  if (N == 0) return;
  queue<int> q, next_q;
  dist.assign(N, INF);
  previous.assign(N, -1);
  for (int src : source) bfs_check(q, next_q, src, -1, 0, 0);
  int level = 0;
  while (!q.empty() || !next_q.empty()) {
    while (!q.empty()) {
      int top = q.front();
      q.pop();
      if (level > dist[top]) continue;
      for (edge &e : adj[top])
        bfs_check(q, next_q, e.node, top, dist[top] + e.weight, e.weight);
    }
    swap(q, next_q);
    level++;
  }
}
struct union_find {
  vector<int> data;
  int components = 0;
  union_find(int n = -1) {
    if (n >= 0) init(n);
  }
  void init(int n) {
    data.assign(n + 1, -1);
    components = n;
  }
  int find(int x) { return data[x] < 0 ? x : data[x] = find(data[x]); }
  int get_size(int x) { return -data[find(x)]; }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    if (-data[x] < -data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    components--;
    return true;
  }
};
int K, R, V;
vector<pair<int, int>> edges;
vector<int> rests;
LCA lca;
union_find UF;
bool query(int a, int b) {
  if (lca.get_dist(a, b) <= K) return true;
  int jump_a = lca.get_kth_node_on_path(a, b, (K + 1) / 2);
  int jump_b = lca.get_kth_node_on_path(b, a, (K + 1) / 2);
  if (dist[jump_a] > K / 2 || dist[jump_b] > K / 2) return false;
  return UF.find(jump_a) == UF.find(jump_b);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> K >> R;
  lca.init(N);
  adj.assign(N, {});
  for (int i = 0; i < N - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    lca.add_edge(x, y);
    adj[x].emplace_back(y, 1);
    adj[y].emplace_back(x, 1);
    edges.emplace_back(x, y);
  }
  lca.build();
  rests.resize(R);
  for (int &rest : rests) {
    cin >> rest;
    rest--;
  }
  bfs(rests);
  UF.init(N);
  for (pair<int, int> &e : edges)
    if (dist[e.first] + 1 + dist[e.second] <= K) UF.unite(e.first, e.second);
  cin >> V;
  for (int v = 0; v < V; v++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    cout << (query(a, b) ? "YES" : "NO") << '\n';
  }
}

### Prompt

Please formulate a Cpp solution to the following problem:

Bessie is planning a vacation! In Cow-lifornia, there are n cities, with n-1 bidirectional roads connecting them. It is guaranteed that one can reach any city from any other city. 

Bessie is considering v possible vacation plans, with the i-th one consisting of a start city a_i and destination city b_i.

It is known that only r of the cities have rest stops. Bessie gets tired easily, and cannot travel across more than k consecutive roads without resting. In fact, she is so desperate to rest that she may travel through the same city multiple times in order to do so.

For each of the vacation plans, does there exist a way for Bessie to travel from the starting city to the destination city?

Input

The first line contains three integers n, k, and r (2 ≤ n ≤ 2 ⋅ 10^5, 1 ≤ k,r ≤ n) — the number of cities, the maximum number of roads Bessie is willing to travel through in a row without resting, and the number of rest stops.

Each of the following n-1 lines contain two integers x_i and y_i (1 ≤ x_i, y_i ≤ n, x_i ≠ y_i), meaning city x_i and city y_i are connected by a road. 

The next line contains r integers separated by spaces — the cities with rest stops. Each city will appear at most once.

The next line contains v (1 ≤ v ≤ 2 ⋅ 10^5) — the number of vacation plans.

Each of the following v lines contain two integers a_i and b_i (1 ≤ a_i, b_i ≤ n, a_i ≠ b_i) — the start and end city of the vacation plan. 

Output

If Bessie can reach her destination without traveling across more than k roads without resting for the i-th vacation plan, print YES. Otherwise, print NO.

Examples

Input


6 2 1
1 2
2 3
2 4
4 5
5 6
2
3
1 3
3 5
3 6


Output


YES
YES
NO


Input


8 3 3
1 2
2 3
3 4
4 5
4 6
6 7
7 8
2 5 8
2
7 1
8 1


Output


YES
NO

Note

The graph for the first example is shown below. The rest stop is denoted by red.

For the first query, Bessie can visit these cities in order: 1, 2, 3.

For the second query, Bessie can visit these cities in order: 3, 2, 4, 5. 

For the third query, Bessie cannot travel to her destination. For example, if she attempts to travel this way: 3, 2, 4, 5, 6, she travels on more than 2 roads without resting.

<image>

The graph for the second example is shown below. 

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T, bool maximum_mode = false>
struct RMQ {
  int n = 0, levels = 0;
  vector<T> values;
  vector<vector<int>> range_low;
  RMQ(const vector<T> &_values = {}) {
    if (!_values.empty()) build(_values);
  }
  static int largest_bit(int x) { return 31 - __builtin_clz(x); }
  int better_index(int a, int b) const {
    return (maximum_mode ? values[b] < values[a] : values[a] < values[b]) ? a
                                                                          : b;
  }
  void build(const vector<T> &_values) {
    values = _values;
    n = values.size();
    levels = largest_bit(n) + 1;
    range_low.resize(levels);
    for (int k = 0; k < levels; k++) range_low[k].resize(n - (1 << k) + 1);
    for (int i = 0; i < n; i++) range_low[0][i] = i;
    for (int k = 1; k < levels; k++)
      for (int i = 0; i <= n - (1 << k); i++)
        range_low[k][i] = better_index(range_low[k - 1][i],
                                       range_low[k - 1][i + (1 << (k - 1))]);
  }
  int query_index(int a, int b) const {
    assert(0 <= a && a < b && b <= n);
    int level = largest_bit(b - a);
    return better_index(range_low[level][a],
                        range_low[level][b - (1 << level)]);
  }
  T query_value(int a, int b) const { return values[query_index(a, b)]; }
};
struct LCA {
  int n = 0;
  vector<vector<int>> adj;
  vector<int> parent, depth, subtree_size;
  vector<int> euler, first_occurrence;
  vector<int> tour_start, tour_end, tour_list, postorder;
  vector<int> heavy_root;
  RMQ<int> rmq;
  LCA(int _n = 0) { init(_n); }
  LCA(const vector<vector<int>> &_adj) { init(_adj); }
  void init(int _n) {
    n = _n;
    adj.assign(n, {});
    parent.resize(n);
    depth.resize(n);
    subtree_size.resize(n);
    first_occurrence.resize(n);
    tour_start.resize(n);
    tour_end.resize(n);
    tour_list.resize(n);
    postorder.resize(n);
    heavy_root.resize(n);
  }
  void init(const vector<vector<int>> &_adj) {
    init(_adj.size());
    adj = _adj;
  }
  void add_edge(int a, int b) {
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  void dfs(int node, int par) {
    parent[node] = par;
    depth[node] = par < 0 ? 0 : depth[par] + 1;
    subtree_size[node] = 1;
    if (par >= 0)
      adj[node].erase(find(adj[node].begin(), adj[node].end(), par));
    for (int &child : adj[node]) {
      dfs(child, node);
      subtree_size[node] += subtree_size[child];
    }
    sort(adj[node].begin(), adj[node].end(),
         [&](int a, int b) { return subtree_size[a] > subtree_size[b]; });
  }
  int tour, post_tour;
  void tour_dfs(int node, bool heavy) {
    heavy_root[node] = heavy ? heavy_root[parent[node]] : node;
    first_occurrence[node] = euler.size();
    euler.push_back(node);
    tour_list[tour] = node;
    tour_start[node] = tour++;
    bool heavy_child = true;
    for (int child : adj[node]) {
      tour_dfs(child, heavy_child);
      euler.push_back(node);
      heavy_child = false;
    }
    tour_end[node] = tour;
    postorder[node] = post_tour++;
  }
  void build() {
    parent.assign(n, -1);
    for (int i = 0; i < n; i++)
      if (parent[i] < 0) dfs(i, -1);
    tour = post_tour = 0;
    for (int i = 0; i < n; i++)
      if (parent[i] < 0) {
        tour_dfs(i, false);
        euler.push_back(-1);
      }
    assert((int)euler.size() == 2 * n);
    vector<int> euler_depths;
    for (int node : euler)
      euler_depths.push_back(node < 0 ? node : depth[node]);
    rmq.build(euler_depths);
  }
  pair<int, int> find_farthest(int node, int par, int path) const {
    pair<int, int> current = {path, node};
    for (int neighbor : adj[node])
      if (neighbor != par)
        current = max(current, find_farthest(neighbor, node, path + 1));
    return current;
  }
  pair<int, pair<int, int>> get_diameter() const {
    int u = find_farthest(0, -1, 0).second;
    pair<int, int> farthest = find_farthest(u, -1, 0);
    int v = farthest.second;
    return {farthest.first, {u, v}};
  }
  int get_lca(int a, int b) const {
    a = first_occurrence[a];
    b = first_occurrence[b];
    if (a > b) swap(a, b);
    return euler[rmq.query_index(a, b + 1)];
  }
  bool is_ancestor(int a, int b) const {
    return tour_start[a] <= tour_start[b] && tour_start[b] < tour_end[a];
  }
  bool on_path(int x, int a, int b) const {
    return (is_ancestor(x, a) || is_ancestor(x, b)) &&
           is_ancestor(get_lca(a, b), x);
  }
  int get_dist(int a, int b) const {
    return depth[a] + depth[b] - 2 * depth[get_lca(a, b)];
  }
  int child_ancestor(int a, int b) const {
    assert(a != b);
    assert(is_ancestor(a, b));
    int child =
        euler[rmq.query_index(first_occurrence[a], first_occurrence[b] + 1) +
              1];
    assert(parent[child] == a);
    assert(is_ancestor(child, b));
    return child;
  }
  int get_kth_ancestor(int a, int k) const {
    while (a >= 0) {
      int root = heavy_root[a];
      if (depth[root] <= depth[a] - k) return tour_list[tour_start[a] - k];
      k -= depth[a] - depth[root] + 1;
      a = parent[root];
    }
    return a;
  }
  int get_kth_node_on_path(int a, int b, int k) const {
    int anc = get_lca(a, b);
    int first_half = depth[a] - depth[anc];
    int second_half = depth[b] - depth[anc];
    assert(0 <= k && k <= first_half + second_half);
    if (k < first_half)
      return get_kth_ancestor(a, k);
    else
      return get_kth_ancestor(b, first_half + second_half - k);
  }
};
const int INF = 1e9 + 5;
struct edge {
  int node = -1, weight = -1;
  edge() {}
  edge(int _node, int _weight) : node(_node), weight(_weight) {}
};
int N;
vector<vector<edge>> adj;
vector<int> dist;
vector<int> previous;
void bfs_check(queue<int> &q, queue<int> &next_q, int node, int from,
               int new_dist, int add) {
  assert(0 <= add && add <= 1);
  if (new_dist < dist[node]) {
    dist[node] = new_dist;
    previous[node] = from;
    (add == 0 ? q : next_q).push(node);
  }
}
void bfs(const vector<int> &source) {
  if (N == 0) return;
  queue<int> q, next_q;
  dist.assign(N, INF);
  previous.assign(N, -1);
  for (int src : source) bfs_check(q, next_q, src, -1, 0, 0);
  int level = 0;
  while (!q.empty() || !next_q.empty()) {
    while (!q.empty()) {
      int top = q.front();
      q.pop();
      if (level > dist[top]) continue;
      for (edge &e : adj[top])
        bfs_check(q, next_q, e.node, top, dist[top] + e.weight, e.weight);
    }
    swap(q, next_q);
    level++;
  }
}
struct union_find {
  vector<int> data;
  int components = 0;
  union_find(int n = -1) {
    if (n >= 0) init(n);
  }
  void init(int n) {
    data.assign(n + 1, -1);
    components = n;
  }
  int find(int x) { return data[x] < 0 ? x : data[x] = find(data[x]); }
  int get_size(int x) { return -data[find(x)]; }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    if (-data[x] < -data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    components--;
    return true;
  }
};
int K, R, V;
vector<pair<int, int>> edges;
vector<int> rests;
LCA lca;
union_find UF;
bool query(int a, int b) {
  if (lca.get_dist(a, b) <= K) return true;
  int jump_a = lca.get_kth_node_on_path(a, b, (K + 1) / 2);
  int jump_b = lca.get_kth_node_on_path(b, a, (K + 1) / 2);
  if (dist[jump_a] > K / 2 || dist[jump_b] > K / 2) return false;
  return UF.find(jump_a) == UF.find(jump_b);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> K >> R;
  lca.init(N);
  adj.assign(N, {});
  for (int i = 0; i < N - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    lca.add_edge(x, y);
    adj[x].emplace_back(y, 1);
    adj[y].emplace_back(x, 1);
    edges.emplace_back(x, y);
  }
  lca.build();
  rests.resize(R);
  for (int &rest : rests) {
    cin >> rest;
    rest--;
  }
  bfs(rests);
  UF.init(N);
  for (pair<int, int> &e : edges)
    if (dist[e.first] + 1 + dist[e.second] <= K) UF.unite(e.first, e.second);
  cin >> V;
  for (int v = 0; v < V; v++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    cout << (query(a, b) ? "YES" : "NO") << '\n';
  }
}

```