#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, M = N * 2, NN = N * 2;
int n, m, q;
int fir[N], to[M], nxt[M], eds = 1, pa[N];
void addedge(int u, int v) {
  to[++eds] = v;
  nxt[eds] = fir[u];
  fir[u] = eds;
}
int dfn[N], low[N], dfc, st[N], top, eccn, bel[N];
void Tarjan(int u, int from) {
  dfn[u] = low[u] = ++dfc;
  st[++top] = u;
  for (int i = fir[u], v; v = to[i], i; i = nxt[i])
    if (i != (from ^ 1)) {
      if (!dfn[v]) {
        pa[v] = u, Tarjan(v, i);
        low[u] = min(low[u], low[v]);
      } else
        low[u] = min(low[u], dfn[v]);
    }
  if (low[u] == dfn[u]) {
    do bel[st[top]] = u;
    while (st[top--] != u);
  }
}
namespace LCT {
int fa[NN], ch[NN][2], eq[NN], nds;
bool val[NN], sum[NN], rev[NN], typ[NN];
int newnode() {
  ++nds;
  val[nds] = sum[nds] = typ[nds] = 1;
  rev[nds] = eq[nds] = ch[nds][0] = ch[nds][1] = 0;
  return nds;
}
int nroot(int x) { return ch[fa[x]][1] == x || ch[fa[x]][0] == x; }
int chk(int x) { return ch[fa[x]][1] == x; }
void pushup(int u) {
  sum[u] = (sum[ch[u][0]] | sum[ch[u][1]] | val[u]);
  typ[u] = (typ[ch[u][0]] | typ[ch[u][1]] | (u > n));
}
void putrev(int u) {
  swap(ch[u][0], ch[u][1]);
  rev[u] ^= 1;
}
void puteq(int u, int vl) {
  eq[u] = vl;
  if (vl == 2)
    sum[u] = typ[u], val[u] = (u > n);
  else
    sum[u] = val[u] = 0;
}
void pushdown(int u) {
  if (rev[u]) {
    putrev(ch[u][0]);
    putrev(ch[u][1]);
    rev[u] = 0;
  }
  if (eq[u]) {
    puteq(ch[u][0], eq[u]);
    puteq(ch[u][1], eq[u]);
    eq[u] = 0;
  }
}
void rotate(int x) {
  static int y, z, w, d;
  z = fa[y = fa[x]];
  d = chk(x);
  w = ch[x][d ^ 1];
  if (nroot(y)) ch[z][chk(y)] = x;
  ch[x][d ^ 1] = y;
  ch[y][d] = w;
  if (w) fa[w] = y;
  fa[x] = z;
  fa[y] = x;
  pushup(y);
}
int stk[N];
void splay(int x) {
  static int y, z;
  stk[z = 1] = y = x;
  while (nroot(y)) stk[++z] = y = fa[y];
  while (z) pushdown(stk[z--]);
  while (nroot(x)) {
    z = fa[y = fa[x]];
    if (nroot(y)) rotate(chk(x) ^ chk(y) ? x : y);
    rotate(x);
  }
  pushup(x);
}
void access(int x) {
  for (int y = 0; x; y = x, x = fa[x]) splay(x), ch[x][1] = y, pushup(x);
}
void makeroot(int x) {
  access(x);
  splay(x);
  putrev(x);
}
int findroot(int x) {
  access(x);
  splay(x);
  while (ch[x][0]) pushdown(x), x = ch[x][0];
  splay(x);
  return x;
}
int chkcon(int x, int y) {
  makeroot(x);
  return findroot(y) == x;
}
int link(int x, int y) {
  if (chkcon(x, y)) return 0;
  fa[x] = newnode();
  fa[nds] = y;
  return nds;
}
void cut(int x, int y) {
  makeroot(x);
  access(y);
  splay(y);
  splay(x);
  ch[x][1] = 0, fa[y] = 0;
  pushup(x);
}
void split(int x, int y) {
  makeroot(x);
  access(y);
  splay(y);
}
void change(int x, int y, int vl) {
  split(x, y);
  puteq(y, vl + 1);
}
int query(int x, int y) {
  split(x, y);
  return sum[y];
}
}  // namespace LCT
using namespace LCT;
vector<int> nd;
vector<pair<int, int> > eg;
int vis[N];
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1, u, v; i <= m; ++i) {
    scanf("%d%d", &u, &v);
    addedge(u, v);
    addedge(v, u);
  }
  for (int i = (1); i <= (n); ++i)
    if (!dfn[i]) Tarjan(i, 0);
  nds = n;
  for (int i = (1); i <= (n); ++i)
    if (bel[i] == i && pa[i]) link(i, bel[pa[i]]);
  int res = 0, ans, nn, mm, resn = nds;
  for (int kas = (1); kas <= (q); ++kas) {
    scanf("%d%d", &nn, &mm);
    nds = resn;
    nd.resize(nn);
    eg.resize(mm);
    for (int i = (0); i < (nn); ++i) {
      scanf("%d", &nd[i]);
      nd[i] = (nd[i] + res - 1) % n + 1;
    }
    for (int i = (0); i < (mm); ++i) {
      scanf("%d%d", &eg[i].first, &eg[i].second);
      eg[i].first = bel[(eg[i].first + res - 1) % n + 1];
      eg[i].second = bel[(eg[i].second + res - 1) % n + 1];
      vis[i] = link(eg[i].first, eg[i].second);
      if (!vis[i]) change(eg[i].first, eg[i].second, 0);
    }
    ans = 1;
    for (int i = (1); i < (nn); ++i)
      if (!chkcon(bel[nd[i - 1]], bel[nd[i]]) ||
          query(bel[nd[i - 1]], bel[nd[i]])) {
        ans = 0;
        break;
      }
    for (int i = (mm - 1); i >= (0); --i)
      if (vis[i])
        cut(eg[i].first, vis[i]), cut(eg[i].second, vis[i]);
      else
        change(eg[i].first, eg[i].second, 1);
    (res += ans * kas) %= n;
    puts(ans ? "YES" : "NO");
  }
  return 0;
}
