#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
inline int Read(int &r) {
  int b = 1, c = getchar();
  r = 0;
  while (c < '0' || '9' < c) b = c == '-' ? -1 : b, c = getchar();
  while ('0' <= c && c <= '9')
    r = (r << 1) + (r << 3) + (c ^ '0'), c = getchar();
  return r *= b;
}
struct GRAPH {
  int head[N], to[N << 1], nxt[N << 1], ncnt;
  int ru[N][2], rv[N][2], nr;
  GRAPH() { ncnt = 1; }
  void AddEdge(const int &u, const int &v, bool rol = false) {
    int p = ++ncnt, q = ++ncnt;
    if (rol) {
      nr++;
      ru[nr][0] = u, ru[nr][1] = head[u];
      rv[nr][0] = v, rv[nr][1] = head[v];
    }
    to[p] = v, nxt[p] = head[u], head[u] = p;
    to[q] = u, nxt[q] = head[v], head[v] = q;
  }
  void RollBack() {
    while (nr) {
      nxt[head[ru[nr][0]] = ru[nr][1]] = 0;
      nxt[head[rv[nr][0]] = rv[nr][1]] = 0;
      nr--;
    }
  }
  void Clear(const int &n) {
    for (int i = 1; i <= n; i++) head[i] = 0;
    ncnt = 1;
  }
  inline int operator[](const int &u) { return head[u]; }
} Gr, Tr, Ne;
int n, m, Q, ndfn, nstk, ncc, loc, ntmpp, nrid, ndfm, ndd;
int cc[N], dfn[N], low[N], stk[N], sp[N], tmpp[N * 3], anc[N][20], dep[N],
    rid[N], exedg[N][2], dfm[N], lom[N], dd[N];
inline int Unlock(int &r) {
  int x = (Read(r) + loc) % n;
  if (x == 0) return r = n;
  return r = x;
}
void Tarjan(const int &u, const int &las) {
  dfn[u] = low[u] = ++ndfn;
  stk[++nstk] = u;
  for (int it = Gr[u]; it; it = Gr.nxt[it]) {
    int v = Gr.to[it];
    if ((it >> 1) == las) continue;
    if (!dfn[v]) {
      Tarjan(v, it >> 1);
      low[u] = min(low[u], low[v]);
    } else
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    ncc++;
    int tmp = -1;
    do cc[tmp = stk[nstk--]] = ncc;
    while (tmp != u);
  }
}
void TreeDFS(const int &u, const int &fa) {
  dfn[u] = ++ndfn, anc[u][0] = fa, dep[u] = dep[fa] + 1;
  for (int i = 1; i < 20; i++) anc[u][i] = anc[anc[u][i - 1]][i - 1];
  for (int it = Tr[u]; it; it = Tr.nxt[it]) {
    int v = Tr.to[it];
    if (v == fa) continue;
    TreeDFS(v, u);
  }
}
bool cmp(const int &u, const int &v) { return dfn[u] < dfn[v]; }
int LCA(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  for (int i = 19; i >= 0; i--)
    if (dep[anc[u][i]] >= dep[v]) u = anc[u][i];
  if (u == v) return u;
  for (int i = 19; i >= 0; i--)
    if (anc[u][i] != anc[v][i]) u = anc[u][i], v = anc[v][i];
  return anc[u][0];
}
void TarjanNew(const int &u, const int &las) {
  dfm[u] = lom[u] = ++ndfm;
  stk[++nstk] = u;
  for (int it = Ne[u]; it; it = Ne.nxt[it]) {
    int v = Ne.to[it];
    if ((it >> 1) == las) continue;
    if (!dfm[v]) {
      TarjanNew(v, it >> 1);
      lom[u] = min(lom[u], lom[v]);
    } else
      lom[u] = min(lom[u], dfm[v]);
  }
  if (lom[u] == dfm[u]) {
    ndd++;
    int tmp = -1;
    do dd[tmp = stk[nstk--]] = ndd;
    while (tmp != u);
  }
}
int main() {
  Read(n), Read(m), Read(Q);
  for (int i = 1, u, v; i <= m; i++) Gr.AddEdge(Read(u), Read(v));
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) Tarjan(i, -1);
  for (int u = 1; u <= n; u++)
    for (int it = Gr[u]; it; it = Gr.nxt[it]) {
      int v = Gr.to[it];
      if (dfn[v] > dfn[u] && cc[v] != cc[u]) Tr.AddEdge(cc[u], cc[v]);
    }
  ndfn = 0, memset(dfn, 0, sizeof dfn);
  for (int u = 1; u <= ncc; u++)
    if (!dfn[u]) TreeDFS(u, 0);
  for (int t = 1, ni, mi; t <= Q; t++) {
    Read(ni), Read(mi);
    ntmpp = 0;
    for (int i = 1; i <= ni; i++) {
      tmpp[++ntmpp] = cc[Unlock(sp[i])];
    }
    for (int i = 1; i <= mi; i++) {
      tmpp[++ntmpp] = cc[Unlock(exedg[i][0])];
      tmpp[++ntmpp] = cc[Unlock(exedg[i][1])];
    }
    sort(tmpp + 1, tmpp + 1 + ntmpp, cmp);
    nstk = nrid = 0;
    for (int i = 1; i <= ntmpp; i++)
      if (tmpp[i] != tmpp[i - 1]) {
        int u = tmpp[i];
        rid[u] = ++nrid;
        if (!nstk) {
          stk[++nstk] = u;
          continue;
        }
        int lca = LCA(u, stk[nstk]), las = -1;
        while (nstk && dep[stk[nstk]] > dep[lca]) {
          int it = stk[nstk--];
          if (~las) {
            Ne.AddEdge(rid[las], rid[it]);
          }
          las = it;
        }
        if (lca) {
          if (lca != stk[nstk]) {
            rid[lca] = ++nrid;
            stk[++nstk] = lca;
          }
          if (~las) {
            Ne.AddEdge(rid[las], rid[lca]);
          }
        }
        stk[++nstk] = u;
      }
    for (int las = -1; nstk; nstk--) {
      int u = stk[nstk];
      if (~las) {
        Ne.AddEdge(rid[u], rid[las]);
      }
      las = u;
    }
    for (int i = 1; i <= mi; i++) {
      Ne.AddEdge(rid[cc[exedg[i][0]]], rid[cc[exedg[i][1]]]);
    }
    ndfm = ndd = 0;
    for (int i = 1; i <= nrid; i++)
      if (!dfm[i]) TarjanNew(i, 0);
    bool ans = true;
    for (int i = 2; i <= ni; i++)
      if (dd[rid[cc[sp[i]]]] != dd[rid[cc[sp[i - 1]]]]) {
        ans = false;
        break;
      }
    printf("%s\n", ans ? "YES" : "NO");
    if (ans) loc = (loc + t) % n;
    Ne.Clear(nrid);
    for (int i = 1; i <= nrid; i++) dfm[i] = lom[i] = dd[i] = 0;
  }
  return 0;
}
