#include <bits/stdc++.h>
using namespace std;
const int Maxx = 1000005, Maxn = 2005, INF = 0x3f3f3f3f, Mod = 1e9 + 7;
inline int read() {
  int res = 0;
  char bj = 0, ch = getchar();
  while (ch < '0' || ch > '9') bj |= (ch == '-'), ch = getchar();
  while (ch >= '0' && ch <= '9')
    res = (res << 3) + (res << 1) + (ch ^ 48), ch = getchar();
  return bj ? -res : res;
}
void print(int x) {
  if (x > 9) print(x / 10);
  putchar(x % 10 ^ 48);
}
inline void printnum(int x, char ch) {
  if (x < 0) putchar('-'), x = -x;
  print(x), putchar(ch);
}
int cnt, h[Maxx], to[Maxx << 1], nx[Maxx << 1];
int tp, num, tmc, fl[Maxx], bl[Maxx], stk[Maxx], dfn[Maxx], low[Maxx];
char vs[Maxx];
inline void ckmin(int &x, const int y) { x = x < y ? x : y; }
void Tarjan(int x, int pr) {
  dfn[x] = low[x] = ++tmc, vs[stk[++tp] = x] = 1;
  for (int i = h[x], y; i; i = nx[i]) {
    if (!dfn[y = to[i]])
      Tarjan(y, i), ckmin(low[x], low[y]);
    else if (i ^ pr ^ 1 && vs[y])
      ckmin(low[x], dfn[y]);
  }
  if (dfn[x] == low[x]) {
    ++num;
    int y;
    do vs[y = stk[tp--]] = 0, fl[y] = num;
    while (y != x);
  }
}
int d[Maxx], I[Maxx], rt[Maxx], sz[Maxx], sn[Maxx], fp[Maxx], prt[Maxx];
void Dfs1(int x, int r) {
  vs[x] = sz[x] = 1, rt[x] = r;
  for (int i = h[x], y; i; i = nx[i])
    if (!vs[y = to[i]]) {
      d[y] = d[x] + 1, prt[y] = x, Dfs1(y, r), sz[x] += sz[y];
      if (sz[sn[x]] < sz[y]) sn[x] = y;
    }
}
void Dfs2(int x, int bo) {
  fp[x] = bo, vs[x] = 2, I[x] = ++cnt;
  if (sn[x]) {
    Dfs2(sn[x], bo);
    for (int i = h[x], y; i; i = nx[i])
      if (vs[y = to[i]] == 1) Dfs2(y, y);
  }
}
inline int lca(int x, int y) {
  while (fp[x] != fp[y]) {
    if (d[fp[x]] < d[fp[y]]) swap(x, y);
    x = prt[fp[x]];
  }
  return d[x] < d[y] ? x : y;
}
inline bool cmp(int x, int y) { return I[x] < I[y]; }
int X[Maxx], Y[Maxx], fd[Maxx], q[Maxx];
inline void Add(int x, int y) {
  nx[++cnt] = h[x], to[h[x] = cnt] = y;
  nx[++cnt] = h[y], to[h[y] = cnt] = x;
}
int main() {
  int n = read(), m = read(), Q = read();
  for (int i = 1, x, y; i <= m; ++i) {
    nx[i << 1] = h[x = read()], to[h[x] = i << 1] = y = read();
    nx[i << 1 | 1] = h[y], to[h[y] = i << 1 | 1] = x, X[i] = x, Y[i] = y;
  }
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) Tarjan(i, 0);
  for (int i = 1; i <= n; ++i) bl[i] = fl[i];
  memset(h, cnt = 0, sizeof(h));
  for (int i = 1, x, y; i <= m; ++i)
    if ((x = bl[X[i]]) != (y = bl[Y[i]])) {
      nx[i << 1] = h[x], to[h[x] = i << 1] = y;
      nx[i << 1 | 1] = h[y], to[h[y] = i << 1 | 1] = x;
    }
  for (int i = 1; i <= num; ++i)
    if (!vs[i]) Dfs1(i, i), Dfs2(i, i);
  memset(vs, 0, sizeof(vs));
  memset(fl, 0, sizeof(fl));
  memset(dfn, 0, sizeof(dfn));
  memset(h, 0, sizeof(h));
  for (int a = 1, b = 0; a <= Q; ++a) {
    int N = read(), m = read(), od = N;
    cnt = 1;
    for (int i = 1; i <= N; ++i) fd[i] = q[i] = bl[(read() + b - 1) % n + 1];
    for (int i = 1; i <= m; ++i) {
      fd[++od] = bl[(read() + b - 1) % n + 1];
      fd[++od] = bl[(read() + b - 1) % n + 1];
      if (fd[od] != fd[od - 1]) Add(fd[od], fd[od - 1]);
    }
    sort(fd + 1, fd + od + 1, cmp), od = unique(fd + 1, fd + od + 1) - fd - 1,
                                    fd[od + 1] = 0;
    for (int i = 1, j = 1; i <= od; i = j) {
      while (rt[fd[i]] == rt[fd[j]]) ++j;
      stk[tp = 1] = rt[fd[i]];
      for (int k = i + (fd[i] == stk[tp]), x; k < j; ++k) {
        if ((x = lca(fd[k], stk[tp])) == stk[tp])
          stk[++tp] = fd[k];
        else {
          while (d[stk[tp - 1]] > d[x]) Add(stk[tp - 1], stk[tp]), --tp;
          Add(x, stk[tp--]);
          if (x != stk[tp]) stk[++tp] = x;
          if (stk[tp] != fd[k]) stk[++tp] = fd[k];
        }
      }
      while (tp > 1) Add(stk[tp - 1], stk[tp]), --tp;
    }
    tmc = num = tp = 0, Tarjan(q[1], 0);
    char bj = 1;
    for (int i = 2; bj && i <= N; ++i) bj &= fl[q[i]] == num;
    puts(bj ? ((b += a) %= n, "YES") : "NO"),
        vs[q[1]] = fl[q[1]] = dfn[q[1]] = 0;
    while (cnt)
      h[to[cnt]] = vs[to[cnt]] = fl[to[cnt]] = dfn[to[cnt]] = 0, --cnt;
  }
  return 0;
}
