#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int A[600406];
int hd[600406], nex[600406 << 2], to[600406 << 2], ecn = 1;
void ade(int u, int v) {
  nex[++ecn] = hd[u], to[ecn] = v, hd[u] = ecn;
  nex[++ecn] = hd[v], to[ecn] = u, hd[v] = ecn;
}
int bel[600406], scc;
namespace ita {
int dfn[600406], clo, low[600406], stk[600406], top, ins[600406];
void tarjan(int u, int ef) {
  dfn[u] = low[u] = ++clo;
  ins[u] = 1, stk[++top] = u;
  for (int i = hd[u]; i; i = nex[i])
    if (i != ef) {
      int v = to[i];
      if (!dfn[v])
        tarjan(v, i ^ 1), low[u] = min(low[u], low[v]);
      else if (ins[v])
        low[u] = min(low[u], dfn[v]);
    }
  if (dfn[u] == low[u]) {
    int x;
    ++scc;
    do {
      x = stk[top--];
      ins[x] = 0;
      bel[x] = scc;
    } while (x != u);
  }
}
}  // namespace ita
vector<int> G[600406];
int dfn[600406], R[600406], clo;
int vis[600406];
int g[600406][20], dep[600406];
void dfs(int u) {
  dfn[u] = ++clo;
  vis[u] = 1;
  for (int v : G[u])
    if (!vis[v]) {
      dep[v] = dep[u] + 1;
      g[v][0] = u;
      for (int k = (1), kend = (18); k <= kend; ++k)
        if (g[g[v][k - 1]][k - 1])
          g[v][k] = g[g[v][k - 1]][k - 1];
        else
          break;
      dfs(v);
    }
  R[u] = clo;
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  if (dep[u] != dep[v])
    for (int k = (18), kend = (0); k >= kend; --k)
      if (dep[g[u][k]] >= dep[v]) u = g[u][k];
  if (u == v) return u;
  for (int k = (18), kend = (0); k >= kend; --k)
    if (g[u][k] != g[v][k]) u = g[u][k], v = g[v][k];
  return g[u][0];
}
vector<int> poi;
int fk[600406];
namespace sta {
int dfn[600406], clo, low[600406], stk[600406], top, ins[600406];
int bel[600406];
void tarjan(int u, int ef) {
  dfn[u] = low[u] = ++clo;
  ins[u] = 1, stk[++top] = u;
  for (int i = hd[u]; i; i = nex[i])
    if (i != ef) {
      int v = to[i];
      if (!dfn[v])
        tarjan(v, i ^ 1), low[u] = min(low[u], low[v]);
      else if (ins[v])
        low[u] = min(low[u], dfn[v]);
    }
  if (dfn[u] == low[u]) {
    int x;
    ++scc;
    do {
      x = stk[top--];
      ins[x] = 0;
      bel[x] = scc;
    } while (x != u);
  }
}
bool getit() {
  for (int x : poi) dfn[x] = low[x] = ins[x] = bel[x] = 0;
  clo = top = scc = 0;
  for (int x : poi)
    if (!dfn[x]) tarjan(x, 0);
  int las = 0;
  for (int x : poi)
    if (fk[x]) {
      if (!las)
        las = bel[x];
      else if (bel[x] != las)
        return false;
    }
  return true;
}
}  // namespace sta
int stk[600406], top;
void solve() {
  cin >> n >> m >> q;
  for (int i = (1), iend = (m); i <= iend; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    ade(u, v);
  }
  for (int i = (1), iend = (n); i <= iend; ++i)
    if (!ita::dfn[i]) ita::tarjan(i, 0);
  for (int u = (1), uend = (n); u <= uend; ++u)
    for (int i = hd[u]; i; i = nex[i])
      if (bel[u] != bel[to[i]]) {
        G[bel[u]].push_back(bel[to[i]]), G[bel[to[i]]].push_back(bel[u]);
      }
  for (int u = (1), uend = (scc); u <= uend; ++u)
    if (!vis[u]) dep[u] = 1, dfs(u);
  int las = 0;
  auto rot = [&](int x) {
    if (!las) return x;
    return (x + las - 1) % n + 1;
  };
  for (int i = (1), iend = (n); i <= iend; ++i) hd[i] = 0;
  for (int t = (1), tend = (q); t <= tend; ++t) {
    int a, b;
    scanf("%d%d", &a, &b);
    poi.resize(a);
    for (int i = (1), iend = (a); i <= iend; ++i) {
      int u;
      scanf("%d", &u);
      u = rot(u);
      poi[i - 1] = bel[u];
      fk[bel[u]] = 1;
    }
    vector<pair<int, int> > ed(b);
    for (int i = (1), iend = (b); i <= iend; ++i) {
      int u, v;
      scanf("%d%d", &u, &v);
      u = bel[rot(u)], v = bel[rot(v)];
      ed[i - 1] = make_pair(u, v);
      poi.push_back(u), poi.push_back(v);
    }
    sort((poi).begin(), (poi).end(),
         [&](int x, int y) { return dfn[x] < dfn[y]; });
    poi.erase(unique((poi).begin(), (poi).end()), poi.end());
    for (int i = (0), iend = (poi.size() - 2); i <= iend; ++i) {
      int s = lca(poi[i], poi[i + 1]);
      if (!s) continue;
      poi.push_back(lca(poi[i], poi[i + 1]));
    }
    sort((poi).begin(), (poi).end(),
         [&](int x, int y) { return dfn[x] < dfn[y]; });
    poi.erase(unique((poi).begin(), (poi).end()), poi.end());
    for (int x : poi) hd[x] = 0;
    top = 0, ecn = 1;
    for (int x : poi) {
      while (top && R[stk[top]] < dfn[x]) --top;
      if (stk[top]) {
        ade(stk[top], x);
      }
      stk[++top] = x;
    }
    for (auto t : ed) ade(t.second, t.first);
    bool as = sta::getit();
    puts(as ? "YES" : "NO");
    if (as) las = (las + t) % n;
    for (int x : poi) fk[x] = 0;
  }
}
signed main() { solve(); }
