#include <bits/stdc++.h>
using namespace std;
const int N = 300005, K = 20;
int n, m, Q;
struct Graph {
  int pp, lnk[N], nxt[N * 2], to[N * 2];
  void clear() {
    while (pp > 1) {
      lnk[to[pp]] = lnk[to[pp ^ 1]] = 0;
      pp -= 2;
    }
    pp = 1;
  }
  Graph() { clear(); }
  void ae(int k1, int k2) { to[++pp] = k2, nxt[pp] = lnk[k1], lnk[k1] = pp; }
  void ae2(int k1, int k2) {
    ((void)0);
    ae(k1, k2), ae(k2, k1);
  }
} G1, G2, G3;
vector<int> rt;
namespace N1 {
int st[N], top, dfn[N], low[N], ind, bel[N], cnt;
void tarjan(int k1, int k2) {
  st[++top] = k1, dfn[k1] = low[k1] = ++ind;
  for (int i = G1.lnk[k1]; i; i = G1.nxt[i])
    if (i / 2 != k2 / 2) {
      if (!dfn[G1.to[i]])
        tarjan(G1.to[i], i), low[k1] = min(low[k1], low[G1.to[i]]);
      else
        low[k1] = min(low[k1], dfn[G1.to[i]]);
    }
  if (low[k1] == dfn[k1]) {
    ++cnt;
    do {
      bel[st[top]] = cnt;
    } while (st[top--] != k1);
  }
}
void init() {
  for (int i = (1); i <= (n); ++i)
    if (!dfn[i]) tarjan(i, 0), rt.push_back(i);
  for (int i = 2; i <= G1.pp; i += 2) {
    int k1 = bel[G1.to[i ^ 1]], k2 = bel[G1.to[i]];
    if (k1 != k2) {
      G2.ae2(k1, k2);
    }
  }
  for (auto& x : rt) x = bel[x];
}
}  // namespace N1
namespace N2 {
int tin[N], tou[N], ind, bel[N], dep[N], fa[N][K];
void dfs(int k1, int k2, int k3) {
  tin[k1] = ++ind, bel[k1] = k3, fa[k1][0] = k2, dep[k1] = dep[k2] + 1;
  for (int i = 1; i < K; ++i) fa[k1][i] = fa[fa[k1][i - 1]][i - 1];
  for (int i = G2.lnk[k1]; i; i = G2.nxt[i])
    if (G2.to[i] != k2) {
      dfs(G2.to[i], k1, k3);
    }
  tou[k1] = ind;
}
void init() {
  for (auto x : rt) dfs(x, 0, x);
}
int LCA(int k1, int k2) {
  if (dep[k1] < dep[k2]) swap(k1, k2);
  int ret = dep[k1] - dep[k2];
  for (int i = (K - 1); i >= (0); --i)
    if (ret >> i & 1) k1 = fa[k1][i];
  if (k1 == k2) return k1;
  for (int i = (K - 1); i >= (0); --i)
    if (fa[k1][i] != fa[k2][i]) k1 = fa[k1][i], k2 = fa[k2][i];
  return fa[k1][0];
}
}  // namespace N2
using N2::LCA;
void bud(int rt, const vector<int>& v) {
  vector<int> st;
  st.push_back(rt);
  for (int i = (0); i <= (((int)(v).size()) - 1); ++i)
    if (st.back() != v[i]) {
      int t = LCA(st.back(), v[i]);
      if (t != st.back()) {
        while (((int)(st).size()) > 1 &&
               N2::dep[t] < N2::dep[st[((int)(st).size()) - 2]]) {
          G3.ae2(st.back(), st[((int)(st).size()) - 2]);
          st.pop_back();
        }
        if (st[((int)(st).size()) - 2] != t) {
          G3.ae2(t, st.back());
          st.pop_back();
          st.push_back(t);
        } else {
          G3.ae2(st[((int)(st).size()) - 2], st.back());
          st.pop_back();
        }
      }
      st.push_back(v[i]);
    }
  while (((int)(st).size()) > 1) {
    ((void)0);
    G3.ae2(st.back(), st[((int)(st).size()) - 2]);
    st.pop_back();
  }
}
namespace N3 {
int st[N], top, dfn[N], low[N], ind, bel[N], cnt;
vector<int> tmp;
void tarjan(int k1, int k2) {
  tmp.push_back(k1);
  st[++top] = k1, dfn[k1] = low[k1] = ++ind;
  for (int i = G3.lnk[k1]; i; i = G3.nxt[i])
    if (i / 2 != k2 / 2) {
      if (!dfn[G3.to[i]])
        tarjan(G3.to[i], i), low[k1] = min(low[k1], low[G3.to[i]]);
      else
        low[k1] = min(low[k1], dfn[G3.to[i]]);
    }
  if (low[k1] == dfn[k1]) {
    ++cnt;
    do {
      bel[st[top]] = cnt;
    } while (st[top--] != k1);
  }
}
int sol(const vector<int>& v, const vector<int>& vv) {
  tmp.clear();
  cnt = 0, ind = 0;
  for (int i = (0); i <= (((int)(v).size()) - 1); ++i) {
    if (!dfn[v[i]]) {
      tarjan(v[i], 0);
    }
  }
  bool flg = 1;
  for (int i = (1); i <= (((int)(vv).size()) - 1); ++i)
    flg &= bel[vv[i]] == bel[vv[0]];
  for (auto x : tmp) dfn[x] = low[x] = 0;
  return flg;
}
}  // namespace N3
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = (1); i <= (m); ++i) {
    int k1, k2;
    scanf("%d%d", &k1, &k2);
    G1.ae2(k1, k2);
  }
  N1::init();
  N2::init();
  int R = 0;
  auto rotate = [&](int x) {
    x = (x + R) % n;
    if (x == 0) x = n;
    return x;
  };
  for (int _ = (1); _ <= (Q); ++_) {
    int n0, m0;
    scanf("%d%d", &n0, &m0);
    vector<int> v, vv;
    vector<pair<int, int> > e;
    for (int i = (1); i <= (n0); ++i) {
      int k1;
      scanf("%d", &k1);
      k1 = rotate(k1);
      if (_ == 2) {
        ((void)0);
      }
      k1 = N1::bel[k1];
      v.push_back(k1), vv.push_back(k1);
    }
    G3.clear();
    for (int i = (1); i <= (m0); ++i) {
      int k1, k2;
      scanf("%d%d", &k1, &k2);
      k1 = rotate(k1), k2 = rotate(k2);
      if (_ == 2) {
        ((void)0);
      }
      k1 = N1::bel[k1], k2 = N1::bel[k2];
      v.push_back(k1), v.push_back(k2);
      e.emplace_back(k1, k2);
    }
    ((void)0);
    sort(v.begin(), v.end(),
         [&](int k1, int k2) { return N2::tin[k1] < N2::tin[k2]; });
    v.erase(unique(v.begin(), v.end()), v.end());
    for (int i = 0, j = 0; i < ((int)(v).size()); i = j) {
      while (j < ((int)(v).size()) && N2::bel[v[i]] == N2::bel[v[j]]) ++j;
      bud(N2::bel[v[i]], vector<int>(v.begin() + i, v.begin() + j));
    }
    for (auto x : e) {
      G3.ae2(x.first, x.second);
    }
    ((void)0);
    int res = N3::sol(v, vv);
    if (res) (R += _) %= n;
    puts(res ? "YES" : "NO");
  }
  return 0;
}
