#include <bits/stdc++.h>
using namespace std;
class edge {
 public:
  int e, nxt;
  bool bridge;
  edge() {}
  edge(int _e, int _nxt) : e(_e), nxt(_nxt), bridge(false) {}
};
int tdfn[300010], tbel[300010], sbel[300010];
int cmp(int a, int b) { return tdfn[a] < tdfn[b]; }
int dep[300010], st[300010][19];
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 18; i >= 0; i--)
    if (dep[st[x][i]] >= dep[y]) x = st[x][i];
  if (x == y) return x;
  for (int i = 18; i >= 0; i--)
    if (st[x][i] != st[y][i]) x = st[x][i], y = st[y][i];
  return st[x][0];
}
class graph {
 public:
  edge g[1200010];
  int head[300010], S, tim, ecnt, bcnt, dfn[300010], bel[300010], low[300010];
  void init(int siz) {
    S = siz;
    fill(dfn + 1, dfn + S + 1, 0);
    fill(head + 1, head + S + 1, -1);
    fill(bel + 1, bel + S + 1, 0);
    ecnt = tim = bcnt = 0;
  }
  void addedge(int s, int e) {
    g[ecnt] = edge(e, head[s]), head[s] = ecnt++;
    g[ecnt] = edge(s, head[e]), head[e] = ecnt++;
  }
  void dfs(int np, int fath) {
    dfn[np] = low[np] = ++tim;
    for (int i = head[np]; i != -1; i = g[i].nxt) {
      if ((i >> 1) == fath) continue;
      if (!dfn[g[i].e]) {
        dfs(g[i].e, i >> 1);
        low[np] = min(low[np], low[g[i].e]);
        if (dfn[np] < low[g[i].e]) g[i].bridge = g[i ^ 1].bridge = 1;
      } else
        low[np] = min(low[np], dfn[g[i].e]);
    }
  }
  void dfst(int np, int fath, int id) {
    dfn[np] = ++tim;
    sbel[np] = id;
    st[np][0] = fath;
    dep[np] = dep[fath] + 1;
    for (int i = 1; i < 19; i++) st[np][i] = st[st[np][i - 1]][i - 1];
    for (int i = head[np]; i != -1; i = g[i].nxt) {
      if (g[i].e == fath) continue;
      dfst(g[i].e, np, id);
    }
  }
  void dfsbcc(int np, int id) {
    bel[np] = id;
    for (int i = head[np]; i != -1; i = g[i].nxt) {
      if (!bel[g[i].e] && !g[i].bridge) dfsbcc(g[i].e, id);
    }
  }
  void findbcc() {
    for (int i = 1; i <= S; i++)
      if (!dfn[i]) dfs(i, 1200002);
    for (int i = 1; i <= S; i++)
      if (!bel[i]) dfsbcc(i, ++bcnt);
  }
  void findbcc(vector<int> pt) {
    for (int &x : pt)
      if (!dfn[x]) dfs(x, 1200002);
    for (int &x : pt)
      if (!bel[x]) dfsbcc(x, ++bcnt);
  }
} Gs, Ts, buf;
bool solve(vector<int> &vertex, vector<pair<int, int> > &edg) {
  vector<int> pt = vertex;
  for (auto &x : edg) {
    pt.push_back(x.first);
    pt.push_back(x.second);
  }
  for (auto &x : pt) x = tbel[x];
  sort(pt.begin(), pt.end());
  pt.erase(unique(pt.begin(), pt.end()), pt.end());
  sort(pt.begin(), pt.end(), cmp);
  vector<int> stk, tpt = pt;
  for (int i = 0; i < pt.size(); i++) {
    if (!i || sbel[pt[i]] != sbel[pt[i - 1]]) {
      while (stk.size() >= 2) {
        buf.addedge(stk[stk.size() - 2], stk.back());
        stk.pop_back();
      }
      stk.clear();
      stk.push_back(pt[i]);
      continue;
    }
    while (stk.size() >= 2) {
      int pmid = lca(pt[i], stk.back());
      if (dep[pmid] > dep[stk[stk.size() - 2]]) {
        if (pmid != stk.back()) {
          buf.addedge(pmid, stk.back());
          tpt.push_back(pmid);
          stk.back() = pmid;
        }
        break;
      } else {
        buf.addedge(stk[stk.size() - 2], stk.back());
        stk.pop_back();
      }
    }
    if (stk.size() == 1) {
      int pmid = lca(pt[i], stk.back());
      if (pmid != stk.back()) {
        tpt.push_back(pmid);
        buf.addedge(pmid, stk.back());
        stk.back() = pmid;
      }
    }
    stk.push_back(pt[i]);
  }
  while (stk.size() >= 2) {
    buf.addedge(stk[stk.size() - 2], stk.back());
    stk.pop_back();
  }
  for (auto &x : edg) {
    if (tbel[x.first] != tbel[x.second])
      buf.addedge(tbel[x.first], tbel[x.second]);
  }
  buf.findbcc(tpt);
  bool res = 1;
  for (int i = 1; i < vertex.size(); i++)
    if (buf.bel[tbel[vertex[i]]] != buf.bel[tbel[vertex[0]]]) res = 0;
  for (auto &x : tpt) buf.dfn[x] = buf.bel[x] = 0, buf.head[x] = -1;
  buf.ecnt = buf.tim = buf.bcnt = 0;
  return res;
}
int n, m, q, R;
int rotate(int element) {
  element = (element + R) % n;
  if (element == 0) {
    element = n;
  }
  return element;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  Gs.init(n);
  for (int i = 1, a, b; i <= m; i++) {
    scanf("%d%d", &a, &b);
    Gs.addedge(a, b);
  }
  Gs.findbcc();
  Ts.init(Gs.bcnt);
  for (int i = 1; i <= n; i++)
    for (int j = Gs.head[i]; j != -1; j = Gs.g[j].nxt)
      if (Gs.g[j].bridge && Gs.g[j].e < i)
        Ts.addedge(Gs.bel[i], Gs.bel[Gs.g[j].e]);
  for (int i = 1, j = 0; i <= Gs.bcnt; i++)
    if (!Ts.dfn[i]) Ts.dfst(i, 0, ++j);
  copy(Gs.bel + 1, Gs.bel + n + 1, tbel + 1);
  copy(Ts.dfn + 1, Ts.dfn + Gs.bcnt + 1, tdfn + 1);
  buf.init(Gs.bcnt);
  for (int T = 1; T <= q; T++) {
    int cn, cm;
    scanf("%d%d", &cn, &cm);
    vector<int> ver(cn);
    vector<pair<int, int> > edg(cm);
    for (int i = 0; i < cn; i++) scanf("%d", &ver[i]), ver[i] = rotate(ver[i]);
    for (int i = 0; i < cm; i++) {
      scanf("%d%d", &edg[i].first, &edg[i].second);
      edg[i].first = rotate(edg[i].first);
      edg[i].second = rotate(edg[i].second);
    }
    if (solve(ver, edg)) {
      puts("YES");
      R = (R + T) % n;
    } else
      puts("NO");
  }
  return 0;
}
