#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m;
struct pot {
  int x, y;
  pot(int _x = 0, int _y = 0) { x = _x, y = _y; }
  pot operator-(pot b) { return pot(x - b.x, y - b.y); }
  pot operator+(pot b) { return pot(x + b.x, y + b.y); }
  long long operator*(pot b) { return (long long)x * b.y - (long long)y * b.x; }
  pot operator*(long long r) { return pot(x * r, y * r); }
} p[N];
vector<pair<double, int> > e[N];
vector<int> sum[N];
map<int, int> loc[N];
int sz[N], vis[N];
void dfs(int x, int f) {
  sum[x].resize(e[x].size());
  sz[x] = 1;
  vis[x] = 1;
  for (auto y : e[x]) {
    if (!vis[y.second]) {
      dfs(y.second, x);
      sum[x][loc[x][y.second]] = -sz[y.second];
      sz[x] += sz[y.second];
    }
  }
  sum[x][loc[x][f]] = sz[x];
  for (int i = 1; i < sum[x].size(); i++) sum[x][i] += sum[x][i - 1];
}
int t[N];
void wr(pot a) { printf("%d %d\n", a.x, a.y); }
void wr(vector<int> a) {
  for (int x : a) printf("%d ", x);
  printf("\n");
}
int main() {
  cin >> n >> m;
  int mix = 1e9;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    e[x].push_back(make_pair(0, y));
    e[y].push_back(make_pair(0, x));
  }
  p[n + 1] = pot(-1e9, -1e9);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &p[i].x, &p[i].y);
    mix = min(mix, p[i].x);
  }
  for (int i = 1; i <= n; i++)
    if (p[i].x == mix) {
      e[i].push_back(make_pair(0, n + 1));
      e[n + 1].push_back(make_pair(0, i));
      break;
    }
  for (int i = 1; i <= n + 1; i++) {
    for (auto &y : e[i]) {
      y.first = atan2(p[y.second].y - p[i].y, p[y.second].x - p[i].x);
    }
    sort(e[i].begin(), e[i].end());
    for (int j = 0; j < e[i].size(); j++) {
      loc[i][e[i][j].second] = j;
    }
  }
  dfs(n + 1, 0);
  int q = 0;
  cin >> q;
  for (int o = 1; o <= q; o++) {
    int k;
    scanf("%d", &k);
    int ans = 0;
    for (int i = 1; i <= k; i++) scanf("%d", &t[i]);
    long long u = 0;
    for (int i = 2; i < k; i++)
      u += (p[t[i]] - p[t[1]]) * (p[t[i + 1]] - p[t[1]]);
    if (u < 0) reverse(t + 1, t + 1 + k);
    t[0] = t[k], t[k + 1] = t[1];
    for (int i = 1; i <= k; i++) {
      int l = loc[t[i]][t[i - 1]], r = loc[t[i]][t[i + 1]];
      if (l <= r) {
        assert(l != r);
        ans += sum[t[i]][r - 1] - sum[t[i]][l];
      } else {
        ans += sum[t[i]].back() - sum[t[i]][l];
        if (r > 0) ans += sum[t[i]][r - 1];
      }
    }
    printf("%d\n", ans);
  }
}
