#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
int n, m, qe, x, y, ni, mi, sumyes, a[MAXN], z[MAXN], ta, q[MAXN], t[MAXN],
    vis[MAXN], root[MAXN], fa[MAXN][19], de[MAXN];
bool mark[2 * MAXN];
inline int read() {
  int x = 0;
  char c = getchar();
  while (c < '0') c = getchar();
  while (c >= '0') x = x * 10 + c - '0', c = getchar();
  return x;
}
inline int mask(int x) {
  (x += sumyes) %= n;
  if (x == 0) x = n;
  return x;
}
struct Graph {
  int totl, last[MAXN], pre[2 * MAXN], oth[2 * MAXN], bcc, col[MAXN], dfn[MAXN],
      low[MAXN];
  inline void conn(int a, int b) {
    pre[++totl] = last[a];
    last[a] = totl;
    oth[totl] = b;
  }
  void tarjan(int x, int fp) {
    low[x] = dfn[x] = ++dfn[0];
    z[++ta] = x;
    for (int p = last[x]; p; p = pre[p])
      if (p != (fp ^ 1)) {
        int r = oth[p];
        if (!dfn[r]) {
          tarjan(r, p);
          low[x] = min(low[x], low[r]);
          if (low[r] > dfn[x]) {
            bcc++;
            int s;
            do {
              s = z[ta];
              ta--;
              col[s] = bcc;
            } while (s != r);
            mark[p] = 1;
          }
        } else
          low[x] = min(low[x], dfn[r]);
      }
  }
} G, T, V;
void dfs(int rt, int x) {
  T.dfn[x] = ++T.dfn[0];
  root[x] = rt;
  for (int p = T.last[x]; p; p = T.pre[p]) {
    int r = T.oth[p];
    if (!T.dfn[r]) {
      fa[r][0] = x;
      de[r] = de[x] + 1;
      dfs(rt, r);
    }
  }
}
inline int lca(int a, int b) {
  if (de[a] > de[b]) swap(a, b);
  int dt = de[b] - de[a];
  for (int j = 0; j <= 18; ++j)
    if ((dt >> j) & 1) b = fa[b][j];
  if (b == a) return a;
  for (int j = 18; j >= 0; --j)
    if (fa[a][j] != fa[b][j]) a = fa[a][j], b = fa[b][j];
  return fa[a][0];
}
inline bool cmp(int x, int y) { return T.dfn[x] < T.dfn[y]; }
void build_vtree() {
  sort(t + 1, t + t[0] + 1, cmp);
  for (int i = 1, rr; i <= t[0]; i = rr + 1) {
    rr = i;
    while (rr < t[0] && root[t[rr + 1]] == root[t[i]]) rr++;
    ta = 1;
    z[1] = root[t[i]];
    if (t[i] != root[t[i]]) q[++q[0]] = root[t[i]];
    for (int j = i; j <= rr; ++j) {
      int x = t[j];
      if (x == root[t[i]]) continue;
      int g = lca(x, z[ta]);
      for (; de[g] < de[z[ta]]; --ta) {
        if (de[g] >= de[z[ta - 1]]) {
          V.conn(g, z[ta]), V.conn(z[ta], g);
          ta--;
          if (g != z[ta]) z[++ta] = g, q[++q[0]] = g;
          break;
        }
        V.conn(z[ta - 1], z[ta]), V.conn(z[ta], z[ta - 1]);
      }
      z[++ta] = x;
    }
    for (; ta > 1; --ta) V.conn(z[ta - 1], z[ta]), V.conn(z[ta], z[ta - 1]);
  }
}
int main() {
  n = read();
  m = read();
  qe = read();
  G.totl = 1;
  for (int i = 1; i <= m; ++i) {
    x = read();
    y = read();
    G.conn(x, y);
    G.conn(y, x);
  }
  for (int i = 1; i <= n; ++i)
    if (!G.dfn[i]) {
      G.tarjan(i, 0);
      G.bcc++;
      for (; ta; --ta) G.col[z[ta]] = G.bcc;
      q[++q[0]] = G.bcc;
    }
  for (int i = 2; i <= G.totl; ++i)
    if (mark[i]) {
      T.conn(G.col[G.oth[i ^ 1]], G.col[G.oth[i]]);
    }
  for (int i = 1; i <= q[0]; ++i) dfs(q[i], q[i]);
  for (int j = 1; j <= 18; ++j)
    for (int i = 1; i <= n; ++i) fa[i][j] = fa[fa[i][j - 1]][j - 1];
  for (int T = 1; T <= qe; ++T) {
    ni = read();
    mi = read();
    t[0] = 0;
    for (int i = 1; i <= ni; ++i) {
      x = mask(read());
      a[i] = G.col[x];
      if (vis[G.col[x]] != T) t[++t[0]] = G.col[x], vis[G.col[x]] = T;
    }
    V.totl = 1;
    for (int i = 1; i <= mi; ++i) {
      x = mask(read());
      y = mask(read());
      if (G.col[x] != G.col[y])
        V.conn(G.col[x], G.col[y]), V.conn(G.col[y], G.col[x]);
      if (vis[G.col[x]] != T) t[++t[0]] = G.col[x], vis[G.col[x]] = T;
      if (vis[G.col[y]] != T) t[++t[0]] = G.col[y], vis[G.col[y]] = T;
    }
    for (int i = 1; i <= t[0]; ++i) q[i] = t[i];
    q[0] = t[0];
    build_vtree();
    V.dfn[0] = 0;
    for (int i = 1; i <= q[0]; ++i)
      if (!V.dfn[q[i]]) {
        ta = 0;
        V.tarjan(q[i], 0);
        V.bcc++;
        for (; ta; --ta) V.col[z[ta]] = V.bcc;
      }
    bool no = 0;
    for (int i = 2; i <= ni; ++i)
      if (V.col[a[i]] != V.col[a[1]]) {
        no = 1;
        break;
      }
    if (!no) {
      puts("YES");
      (sumyes += T) %= n;
    } else
      puts("NO");
    for (int i = 1; i <= q[0]; ++i) {
      V.last[q[i]] = 0;
      V.dfn[q[i]] = 0;
    }
  }
  return 0;
}
