#include <bits/stdc++.h>
const int N = 300005;
int n, m, q, tot = 1, head[N];
struct edge {
  int to, nxt;
} e[N << 1];
void link(int x, int y) {
  e[++tot] = (edge){y, head[x]}, head[x] = tot;
  e[++tot] = (edge){x, head[y]}, head[y] = tot;
}
struct tarjan {
  int dfn[N], low[N], bel[N], scc, clk, stack[N], top;
  void _tarjan(int x, int f = 0) {
    dfn[x] = low[x] = ++clk, stack[++top] = x;
    for (int i = head[x]; i; i = e[i].nxt)
      if (i ^ f ^ 1)
        if (!dfn[e[i].to])
          _tarjan(e[i].to, i), low[x] = std::min(low[e[i].to], low[x]);
        else
          low[x] = std::min(low[x], dfn[e[i].to]);
    if (low[x] == dfn[x]) {
      int v;
      ++scc;
      do bel[v = stack[top--]] = scc;
      while (v != x);
    }
  }
  void solve() {
    for (int i = 1; i <= n; ++i)
      if (!dfn[i]) _tarjan(i);
  }
  void solve(const std::vector<int> &points) {
    scc = clk = 0;
    for (int p : points) dfn[p] = 0;
    for (int p : points)
      if (!dfn[p]) _tarjan(p);
  }
} A, B;
int st[19][N], dfn[N], out[N], idx, cnt, id[N];
void dfs(int x, int f = 0) {
  st[0][idx] = f, dfn[x] = ++idx, id[x] = cnt;
  for (int i = head[x]; i; i = e[i].nxt)
    if (e[i].to != f) dfs(e[i].to, x);
  out[x] = idx;
}
int _min(int x, int y) { return dfn[x] < dfn[y] ? x : y; }
void init() {
  for (int i = 1; i < 19; ++i)
    for (int j = 1; j <= n - (1 << i); ++j)
      st[i][j] = _min(st[i - 1][j], st[i - 1][j + (1 << i - 1)]);
}
int lca(int x, int y) {
  if (x == y) return x;
  if (dfn[x] > dfn[y]) std::swap(x, y);
  int k = 31 - __builtin_clz(dfn[y] - dfn[x]);
  return _min(st[k][dfn[x]], st[k][dfn[y] - (1 << k)]);
}
bool in_subtree(int x, int y) { return dfn[x] >= dfn[y] && dfn[x] <= out[y]; }
int R = 0;
int rotate(int x) {
  x = (x + R) % n;
  return x ?: n;
}
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0);
  std::cin >> n >> m >> q;
  static int l[N], r[N];
  for (int i = 0; i < m; ++i) std::cin >> l[i] >> r[i], link(l[i], r[i]);
  A.solve();
  std::memset(head, 0, sizeof head), tot = 1;
  for (int i = 0; i < m; ++i)
    if (A.bel[l[i]] != A.bel[r[i]]) link(A.bel[l[i]], A.bel[r[i]]);
  for (int i = 1; i <= A.scc; ++i)
    if (!id[i]) ++cnt, dfs(i);
  init();
  std::memset(head, 0, sizeof head), tot = 1;
  for (int i = 0; i < q; ++i) {
    auto cmp = [&](int x, int y) { return dfn[x] < dfn[y]; };
    int _n, _m;
    std::cin >> _n >> _m;
    static int a[N];
    std::vector<int> p(_n);
    for (int j = 0, x; j < _n; ++j)
      std::cin >> p[j], p[j] = A.bel[rotate(p[j])], a[j] = p[j];
    for (int j = 0, x, y; j < _m; ++j) {
      std::cin >> l[j] >> r[j], l[j] = A.bel[rotate(l[j])],
                                r[j] = A.bel[rotate(r[j])];
      link(l[j], r[j]), p.emplace_back(l[j]), p.emplace_back(r[j]);
    }
    std::sort(p.begin(), p.end(), cmp),
        p.resize(std::unique(p.begin(), p.end()) - p.begin());
    int t = p.size();
    for (int j = 1; j < t; ++j)
      if (id[p[j]] == id[p[j - 1]]) p.emplace_back(lca(p[j], p[j - 1]));
    std::sort(p.begin(), p.end(), cmp),
        p.resize(std::unique(p.begin(), p.end()) - p.begin());
    static int stack[N], top;
    top = 0;
    for (int j = 0; j < p.size(); ++j) {
      if (!j || id[p[j]] != id[p[j - 1]]) {
        stack[top = 1] = p[j];
      } else {
        while (!in_subtree(p[j], stack[top])) --top;
        if (top) link(p[j], stack[top]);
        stack[++top] = p[j];
      }
    }
    B.solve(p);
    bool flag = 1;
    for (int j = 1; j < _n; ++j)
      if (B.bel[a[j]] != B.bel[a[0]]) {
        flag = 0;
        break;
      }
    std::cout << (flag ? "YES" : "NO") << '\n';
    if (flag) R = (R + i + 1) % n;
    for (int j : p) head[j] = 0;
    tot = 1;
  }
  return 0;
}
