#include <bits/stdc++.h>
using namespace std;
int Df[300005], GG, RR, fw[300005 * 2], U, lt[300005], val[300005], rt[300005],
    color[300005], Dep[300005], st[300005], rev[300005], cnt, fa[300005][20],
    Fa[300005], cl, dfn[300005], in, col[300005], low[300005],
    tot = 1, node[300005], vst[300005 << 1], dep[300005];
vector<int> son[300005], sonn[300005];
struct edge {
  int to, nxt;
} e[300005 << 1];
inline void add(int x, int y) {
  e[++tot].to = y;
  e[tot].nxt = node[x];
  node[x] = tot;
}
void dfs(int now) {
  dfn[now] = low[now] = ++in;
  for (int i = node[now]; i; i = e[i].nxt) {
    if (vst[i] | vst[i ^ 1]) continue;
    vst[i] = 1;
    if (!dfn[e[i].to])
      dep[e[i].to] = dep[now] + 1, Fa[e[i].to] = now, dfs(e[i].to),
      low[now] = min(low[now], low[e[i].to]);
    else
      low[now] = min(low[now], dfn[e[i].to]);
  }
}
void MEM(int now) {
  dfn[now] = 0;
  Fa[now] = dep[now] = 0;
  for (int i = node[now]; i; i = e[i].nxt) {
    if (dfn[e[i].to]) MEM(e[i].to);
  }
  node[now] = 0;
}
void Dfs(int now) {
  col[now] = cl;
  for (int T, i = 0; i < son[now].size(); ++i)
    if (!col[T = son[now][i]]) col[T] = cl, Dfs(T);
}
void Dfs_(int now) {
  color[now] = 0;
  for (int T, i = 0; i < sonn[now].size(); ++i)
    if (!~color[T = sonn[now][i]]) Dfs_(T);
}
void dfs_v(int now, int fat) {
  lt[now] = cnt;
  Df[now] = ++in;
  vst[now] = 1;
  for (int i = 1; i <= 18; ++i) fa[now][i] = fa[fa[now][i - 1]][i - 1];
  for (int T, i = 0; i < son[now].size(); ++i)
    if ((T = son[now][i]) != fat)
      fa[T][0] = now, Dep[T] = Dep[now] + 1, dfs_v(T, now);
}
inline int lca(int x, int y) {
  int i = 18;
  if (Dep[x] < Dep[y]) swap(x, y);
  for (; ~i; --i)
    if (Dep[fa[x][i]] >= Dep[y]) x = fa[x][i];
  if (x == y) return x;
  for (i = 18; ~i; --i)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
inline bool cmp(int x, int y) { return Df[x] < Df[y]; }
int n, m, las, fl, lc, hd, q, v, i, X[300005 * 3], V, AL, E, Y[300005 * 3], x,
    y, j, Ex[300005], Ey[300005];
int main() {
  cin >> n >> m >> q;
  for (i = 1; i <= m; ++i) cin >> x >> y, add(y, x), add(X[i] = x, Y[i] = y);
  for (i = 1; i <= n; ++i)
    if (!dfn[i]) dfs(i);
  for (i = 1; i <= m; ++i)
    if (dep[X[i]] > dep[Y[i]]) swap(X[i], Y[i]);
  for (i = 1; i <= m; ++i) {
    if (Fa[Y[i]] == X[i] && low[Y[i]] > dfn[X[i]]) continue;
    vst[i] = -1;
    son[X[i]].push_back(Y[i]);
    son[Y[i]].push_back(X[i]);
  }
  for (i = 1; i <= n; ++i)
    if (!col[i]) ++cl, Dfs(i);
  for (i = 1; i <= n; ++i) son[i].clear();
  for (i = 1; i <= m; ++i)
    if (col[X[i]] != col[Y[i]])
      sonn[col[X[i]]].push_back(col[Y[i]]),
          sonn[col[Y[i]]].push_back(col[X[i]]);
  for (i = 1; i <= cl; ++i)
    if (sonn[i].size())
      for (sort(sonn[i].begin(), sonn[i].end()), son[i].push_back(sonn[i][0]),
           j = 1;
           j < sonn[i].size(); ++j)
        if (sonn[i][j] != sonn[i][j - 1]) son[i].push_back(sonn[i][j]);
  memset(Fa, 0, sizeof(Fa));
  memset(vst, 0, sizeof(vst));
  memset(dep, 0, sizeof(dep));
  memset(node, 0, sizeof(node));
  memset(dfn, 0, sizeof(dfn));
  in = 0;
  for (i = 1; i <= cl; ++i)
    if (!vst[i]) ++cnt, Dep[i] = 1, rt[cnt] = i, dfs_v(i, 0);
  while (q--) {
    cin >> V >> E;
    ++GG;
    for (i = 1; i <= V; ++i)
      cin >> X[i], X[i] = (X[i] + RR - 1) % n + 1, Y[i] = col[X[i]];
    for (i = 1; i <= E; ++i)
      cin >> X[V + i * 2 - 1] >> X[V + i * 2],
          X[V + i * 2 - 1] = (X[V + i * 2 - 1] + RR - 1) % n + 1,
                        X[V + i * 2] = (X[V + i * 2] + RR - 1) % n + 1,
                        Ex[i] = col[X[V + i * 2 - 1]],
                        Ey[i] = col[X[V + i * 2]];
    AL = V + E + E + 1;
    for (i = 1; i < AL; ++i) X[i] = col[X[i]];
    tot = 1;
    for (i = V + 1; i < AL; i += 2) add(X[i], X[i + 1]), add(X[i + 1], X[i]);
    sort(X + 1, X + AL, cmp);
    X[AL] = X[0] = 300005 - 1;
    U = 0;
    for (las = 1, i = 2; i <= AL; ++i) {
      if (lt[X[i]] != lt[X[i - 1]]) {
        st[hd = 1] = rt[lt[X[las]]];
        fw[++U] = st[1];
        for (j = las; j < i; ++j) {
          if (X[j] == X[j - 1]) continue;
          lc = lca(st[hd], X[j]);
          if (st[hd] != lc) {
            while (Dep[lc] < Dep[st[hd - 1]]) {
              add(st[hd - 1], st[hd]);
              add(st[hd], st[hd - 1]);
              Ex[++E] = st[hd - 1], Ey[E] = st[hd];
              --hd;
            }
            add(lc, st[hd]);
            add(st[hd], lc);
            Ex[++E] = lc, Ey[E] = st[hd];
            --hd;
            if (lc != st[hd]) st[++hd] = lc, fw[++U] = lc;
          }
          if (X[j] != st[hd]) st[++hd] = X[j], fw[++U] = X[j];
        }
        while (hd > 1)
          add(st[hd - 1], st[hd]), add(st[hd], st[hd - 1]),
              Ex[++E] = st[hd - 1], Ey[E] = st[hd], --hd;
        las = i;
      }
    }
    for (i = 1; i <= U; ++i) dfn[fw[i]] = 0;
    for (i = 2; i <= tot; ++i) vst[i] = 0;
    dfs(Y[1]);
    for (fl = 0, i = 2; i <= V; ++i)
      if (!dfn[Y[i]]) fl = 1;
    if (fl) {
      cout << "NO\n";
      MEM(Y[1]);
      for (i = 1; i <= U; ++i) node[fw[i]] = 0;
      continue;
    }
    for (i = 1; i <= U; ++i) sonn[fw[i]].clear();
    for (i = 1; i <= E; ++i)
      if (dep[Ex[i]] > dep[Ey[i]]) swap(Ex[i], Ey[i]);
    for (i = 1; i <= E; ++i) {
      if (Fa[Ey[i]] == Ex[i] && low[Ey[i]] > dfn[Ex[i]]) continue;
      sonn[Ex[i]].push_back(Ey[i]);
      sonn[Ey[i]].push_back(Ex[i]);
    }
    MEM(Y[1]);
    for (i = 1; i <= U; ++i) node[fw[i]] = 0, color[fw[i]] = -1;
    Dfs_(Y[1]);
    for (fl = 0, i = 2; i <= V; ++i)
      if (!~color[Y[i]]) fl = 1;
    if (fl)
      cout << "NO\n";
    else
      cout << "YES\n", (RR += GG) %= n;
  }
  return 0;
}
