#include <bits/stdc++.h>
void RI() {}
template <typename... T>
void RI(int& head, T&... tail) {
  scanf("%d", &head);
  RI(tail...);
}
using namespace std;
int n, m, mnid, q, px[100005], py[100005];
int sid;
bool vis[100005];
vector<pair<int, int> > e[100005];
vector<int> sum[100005], p;
map<pair<int, int>, int> eid;
bool comp(pair<int, int> a, pair<int, int> b) {
  int x = a.first, y = b.first;
  return atan2(py[x] - py[sid], px[x] - px[sid]) <
         atan2(py[y] - py[sid], px[y] - px[sid]);
}
int dfs(int cur, int fa) {
  int re = 1, tmp;
  vis[cur] = true;
  for (__typeof(e[cur].begin()) i = e[cur].begin(); i != e[cur].end(); i++)
    if (!vis[i->first]) {
      tmp = dfs(i->first, cur);
      i->second += tmp;
      re += tmp;
    }
  for (__typeof(e[cur].begin()) i = e[cur].begin(); i != e[cur].end(); i++)
    if (i->first == fa) i->second -= re;
  return re;
}
void init() {
  int x, y;
  RI(n, m);
  for (int i = 1; i <= m; i++) {
    RI(x, y);
    e[x].push_back(make_pair(y, 0));
    e[y].push_back(make_pair(x, 0));
  }
  for (int i = 1; i <= n; i++) RI(px[i], py[i]);
  mnid = 1;
  for (int i = 2; i <= n; i++) {
    if (px[i] < px[mnid])
      mnid = i;
    else if (px[i] == px[mnid] && py[i] < py[mnid])
      mnid = i;
  }
  n++;
  px[n] = px[mnid] - 1;
  py[n] = py[mnid] - 1;
  e[mnid].push_back(make_pair(n, 0));
  e[n].push_back(make_pair(mnid, 0));
  for (int i = 1; i <= n; i++) sid = i, sort(e[i].begin(), e[i].end(), comp);
  dfs(n, -1);
  for (int i = 1; i <= n; i++) {
    int s = 0;
    for (int j = 0; j <= (int)e[i].size() - 1; j++) {
      s += e[i][j].second;
      eid[make_pair(i, e[i][j].first)] = j;
      sum[i].push_back(s);
    }
  }
}
int second(int id, int l, int r) {
  if (l == r) return 0;
  int sz = e[id].size();
  int re;
  r = (r + sz - 1) % sz;
  if (l > r) {
    re = sum[id][sz - 1];
    if (l > 0) re -= sum[id][l - 1];
    return re + sum[id][r];
  }
  re = sum[id][r];
  if (l > 0) re -= sum[id][l - 1];
  return re;
}
bool checkRev() {
  vector<int> a = p;
  a.push_back(a[0]);
  long long re = 0;
  for (int i = 0; i <= (int)a.size() - 2; i++)
    re +=
        (long long)px[a[i]] * py[a[i + 1]] - (long long)py[a[i]] * px[a[i + 1]];
  return re < 0;
}
int main() {
  init();
  int x, k, ans;
  int fid, cid;
  int sz;
  RI(q);
  while (q--) {
    ans = 0;
    p.clear();
    RI(k);
    for (int i = 1; i <= k; i++) RI(x), p.push_back(x);
    if (checkRev()) reverse(p.begin(), p.end());
    p.push_back(p[0]);
    p.push_back(p[1]);
    for (int i = 1; i <= k; i++) {
      sz = e[p[i]].size();
      fid = eid[make_pair(p[i], p[i - 1])];
      cid = eid[make_pair(p[i], p[i + 1])];
      ans -= second(p[i], (fid + 1) % sz, cid);
    }
    printf("%d\n", ans);
  }
  return 0;
}
