#include <bits/stdc++.h>
using namespace std;
char cb[1 << 20], *cs, *ct;
void read(int &a) {
  char c;
  while (!isdigit(
      c = (cs == ct && (ct = (cs = cb) + fread(cb, 1, 1 << 20, stdin), cs == ct)
               ? 0
               : *cs++)))
    ;
  for (a = c - '0';
       isdigit(c = (cs == ct && (ct = (cs = cb) + fread(cb, 1, 1 << 20, stdin),
                                cs == ct)
                        ? 0
                        : *cs++));
       a = a * 10 + c - '0')
    ;
}
const int Log = 18;
int n, m, Q, mod, dfn[300005], tim, rt[300005], dep[300005], f[Log + 1][300005];
vector<int> V[300005], q, p;
vector<pair<int, int> > e;
void dfs(int u, int ff) {
  dep[u] = dep[f[0][u] = ff] + 1, dfn[u] = ++tim;
  for (int j = 1; 1 << j < dep[u]; j++) f[j][u] = f[j - 1][f[j - 1][u]];
  for (int i = 0, v, lim = V[u].size(); i < lim; i++)
    if ((v = V[u][i]) != ff) rt[v] = rt[u], dfs(v, u);
}
int LCA(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  for (int i = 0, d = dep[u] - dep[v]; d; d >>= 1, i++)
    if (d & 1) u = f[i][u];
  if (u == v) return u;
  for (int i = Log; i >= 0; i--)
    if (f[i][u] != f[i][v]) u = f[i][u], v = f[i][v];
  return f[0][u];
}
struct Graph {
  int dfn[300005], low[300005], tim, stk[300005], top, scc[300005], scnt;
  int fir[300005], nxt[1200005], to[1200005], tot;
  Graph() { tot = 1; }
  void add(int x, int y) {
    nxt[++tot] = fir[x], fir[x] = tot, to[tot] = y;
    nxt[++tot] = fir[y], fir[y] = tot, to[tot] = x;
  }
  void tarjan(int u, int ff) {
    dfn[u] = low[u] = ++tim, stk[++top] = u;
    for (int i = fir[u], v; i; i = nxt[i])
      if (i ^ 1 ^ ff) {
        if (!dfn[v = to[i]])
          tarjan(v, i), low[u] = min(low[u], low[v]);
        else
          low[u] = min(low[u], dfn[v]);
      }
    if (dfn[u] == low[u]) {
      ++scnt;
      do scc[stk[top]] = scnt;
      while (stk[top--] != u);
    }
  }
  void build() {
    for (int i = 1; i <= n; i++)
      if (!dfn[i]) tarjan(i, 0);
    for (int i = 1; i <= n; i++)
      for (int j = fir[i]; j; j = nxt[j])
        if (scc[i] != scc[to[j]]) V[scc[i]].push_back(scc[to[j]]);
    for (int i = 1; i <= scnt; i++)
      if (!rt[i]) rt[i] = i, dfs(i, 0);
  }
  void shrink() {
    for (int i = 0, lim = p.size(); i < lim; i++)
      if (!dfn[p[i]]) tarjan(p[i], 0);
  }
  void init() {
    tim = top = scnt = 0, tot = 1;
    for (int i = 0, lim = p.size(); i < lim; i++) dfn[p[i]] = fir[p[i]] = 0;
  }
} G, E;
bool cmp(int i, int j) { return dfn[i] < dfn[j]; }
void VTree() {
  sort(p.begin(), p.end(), cmp), p.erase(unique(p.begin(), p.end()), p.end());
  static int S[300005], tp, now;
  now = tp = 0;
  for (int i = 0, lim = p.size(); i < lim; i++) {
    if (rt[p[i]] != now) {
      for (; tp > 1; tp--) E.add(S[tp - 1], S[tp]);
      S[tp = 1] = p[i], now = rt[p[i]];
      continue;
    }
    int lca = LCA(S[tp], p[i]);
    for (; dfn[lca] <= dfn[S[tp - 1]]; tp--) E.add(S[tp - 1], S[tp]);
    if (lca != S[tp]) E.add(lca, S[tp]), p.push_back(S[tp] = lca);
    S[++tp] = p[i];
  }
  for (; tp > 1; tp--) E.add(S[tp - 1], S[tp]);
}
int main() {
  read(n), read(m), read(Q);
  for (int i = 1, x, y; i <= m; i++) read(x), read(y), G.add(x, y);
  G.build();
  for (int N, M, x, y, t = 1; t <= Q; t++) {
    read(N), read(M), q.clear(), p.clear(), e.clear();
    for (int i = 1; i <= N; i++)
      read(x), x = G.scc[(x + mod - 1) % n + 1], q.push_back(x), p.push_back(x);
    for (int i = 1; i <= M; i++) {
      read(x), read(y), x = G.scc[(x + mod - 1) % n + 1],
                        y = G.scc[(y + mod - 1) % n + 1];
      if (x == y) continue;
      p.push_back(x), p.push_back(y), e.push_back(make_pair(x, y));
    }
    VTree();
    for (int i = 0, lim = e.size(); i < lim; i++)
      E.add(e[i].first, e[i].second);
    E.shrink();
    int id = E.scc[q[0]], flg = 1;
    for (int i = 1; i < N; i++)
      if (id != E.scc[q[i]]) {
        flg = 0;
        break;
      }
    puts(flg ? (mod = (mod + t) % n, "YES") : "NO");
    E.init();
  }
}
