#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  bool f = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = 1;
  for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
  if (f) x = -x;
}
template <typename F>
inline void write(F x, char ed = '\n') {
  static short st[30];
  short tp = 0;
  if (x < 0) putchar('-'), x = -x;
  do st[++tp] = x % 10, x /= 10;
  while (x);
  while (tp) putchar('0' | st[tp--]);
  putchar(ed);
}
template <typename T>
inline void Mx(T &x, T y) {
  x < y && (x = y);
}
template <typename T>
inline void Mn(T &x, T y) {
  x > y && (x = y);
}
const int N = 205000;
struct P {
  long long x, y;
  P(long long xx = 0, long long yy = 0) : x(xx), y(yy) {}
  P operator+(P &a) { return P(x + a.x, y + a.y); }
  P operator-(P &a) { return P(x - a.x, y - a.y); }
  long long operator*(P &a) { return x * a.y - y * a.x; }
  double ang(void) { return atan2(y, x); }
} p[N];
int h[N], ne[N << 1], to[N << 1], w[N << 1], siz[N], tot = 1, n, m, rt;
vector<int> sum[N];
map<int, int> mp[N];
inline void add(int x, int y) { ne[++tot] = h[x], to[h[x] = tot] = y; }
void dfs(int x) {
  siz[x] = 1;
  for (int i = h[x], y; i; i = ne[i]) {
    if (siz[y = to[i]]) continue;
    dfs(y), siz[x] += siz[y];
    w[i] -= siz[y], w[i ^ 1] += siz[y];
  }
}
int id[N], q, tp;
struct node {
  int y, v;
  double ang;
} st[N];
void init(void) {
  for (int x = 1; x <= n; ++x) {
    tp = 0;
    for (int i = h[x], y; i; i = ne[i])
      st[++tp] = (node){y = to[i], w[i], (p[y] - p[x]).ang()};
    sort(st + 1, st + tp + 1, [&](node x, node y) { return x.ang < y.ang; });
    sum[x].resize(tp + 1);
    for (int i = 1; i <= tp; ++i)
      mp[x][st[i].y] = i, sum[x][i] = sum[x][i - 1] + st[i].v;
  }
}
void work(void) {
  read(m);
  for (int i = 1; i <= m; ++i) read(id[i]);
  id[0] = id[m], id[m + 1] = id[1];
  long long S = 0;
  for (int i = 1; i <= m; ++i) S += p[id[i - 1]] * p[id[i]];
  if (S < 0) reverse(id + 1, id + m + 1);
  id[0] = id[m], id[m + 1] = id[1];
  int res = 0;
  for (int i = 1; i <= m; ++i) {
    int x = id[i];
    if (x == rt) res += n;
    int l = mp[x][id[i - 1]], r = mp[x][id[i + 1]];
    int tmp = sum[x][r] - sum[x][l - 1];
    if (l > r) tmp += sum[x].back();
    res += tmp;
  }
  write(res);
}
int main() {
  read(n), read(m), rt = 1;
  for (int i = 1, x, y; i <= m; ++i) read(x), read(y), add(x, y), add(y, x);
  for (int i = 1; i <= n; ++i)
    read(p[i].x), read(p[i].y), p[rt].x > p[i].x && (rt = i);
  for (dfs(rt), init(), read(q); q; --q) work();
  return 0;
}
