#include <bits/stdc++.h>
inline int read() {
  int data = 0, w = 1;
  char ch = getchar();
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') w = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
  return data * w;
}
const int N(3e5 + 10);
struct edge {
  int next, to;
} e[N << 2];
int n, m, Q, R, dfn[N], low[N], col[N], head[N], e_num = 1, tim, tot, c[N];
int fa[N], size[N], heavy[N], pos[N], bel[N], cnt, bri[N << 2], vis[N];
std::vector<int> qV, G[N];
inline void add_edge(int from, int to) {
  e[++e_num] = (edge){head[from], to}, head[from] = e_num;
}
inline int Decode() { return c[(read() + R - 1) % n + 1]; }
void tarjan(int x, int p) {
  dfn[x] = low[x] = ++tim;
  for (int i = head[x]; i; i = e[i].next) {
    int to = e[i].to;
    if (!dfn[to]) {
      tarjan(to, i), low[x] = std::min(low[x], low[to]);
      if (low[to] > dfn[x]) bri[i] = bri[i ^ 1] = 1;
    } else if (p != (i ^ 1))
      low[x] = std::min(low[x], dfn[to]);
  }
}
void find(int x) {
  col[x] = tot;
  for (int i = head[x]; i; i = e[i].next)
    if (!col[e[i].to] && !bri[i]) find(e[i].to);
}
void shrink() {
  for (int i = 1; i <= n; i++)
    if (!col[i]) ++tot, find(i);
}
void dfs(int x) {
  size[x] = 1;
  for (auto i : G[x])
    if (i != fa[x]) {
      fa[i] = x, dfs(i), size[x] += size[i];
      if (size[heavy[x]] < size[i]) heavy[x] = i;
    }
}
void dfs(int x, int c) {
  pos[x] = ++cnt, bel[x] = c;
  if (heavy[x]) dfs(heavy[x], c);
  for (auto i : G[x])
    if (i != fa[x] && i != heavy[x]) dfs(i, i);
}
int LCA(int x, int y) {
  for (; bel[x] != bel[y]; x = fa[bel[x]])
    if (pos[bel[x]] < pos[bel[y]]) std::swap(x, y);
  return pos[x] < pos[y] ? x : y;
}
void Bvt() {
  if (qV.size() == 1) return;
  static int p[N << 1], stk[N << 1];
  int top = 0, cnt = 0;
  for (auto i : qV) p[++cnt] = i;
  auto cmp = [](int x, int y) { return pos[x] < pos[y]; };
  std::sort(p + 1, p + cnt + 1, cmp),
      cnt = std::unique(p + 1, p + cnt + 1) - p - 1;
  for (int i = 1, t = cnt; i <= t; i++) {
    p[++cnt] = LCA(p[i], p[i % t + 1]);
    if (!p[cnt]) --cnt;
  }
  std::sort(p + 1, p + cnt + 1, cmp),
      cnt = std::unique(p + 1, p + cnt + 1) - p - 1;
  qV.clear(), qV.reserve(cnt);
  for (int i = 1; i <= cnt; i++) qV.push_back(p[i]);
  for (int i = 1; i <= cnt; i++) {
    while (top && pos[stk[top]] + size[stk[top]] - 1 < pos[p[i]]) --top;
    if (top) add_edge(stk[top], p[i]), add_edge(p[i], stk[top]);
    stk[++top] = p[i];
  }
}
int main() {
  n = read(), m = read(), Q = read();
  for (int i = 1, a, b; i <= m; i++)
    a = read(), b = read(), add_edge(a, b), add_edge(b, a);
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i, 0);
  shrink();
  for (int i = 1; i <= n; i++) c[i] = col[i];
  for (int i = 2; i <= e_num; i += 2)
    if (bri[i])
      G[c[e[i].to]].push_back(c[e[i ^ 1].to]),
          G[c[e[i ^ 1].to]].push_back(c[e[i].to]);
  for (int i = 1; i <= tot; i++)
    if (!size[i]) dfs(i), dfs(i, i);
  std::memset(head, 0, sizeof head), e_num = 1, tot = 0;
  std::memset(bri, 0, sizeof bri), std::memset(col, 0, sizeof col);
  for (int T = 1, _n, _m; T <= Q; T++) {
    _n = read(), _m = read(), qV.clear(), qV.reserve(_n + (_m << 1));
    for (int i = 0; i < _n; i++) qV.push_back(Decode()), vis[qV.back()] = 1;
    for (int i = 1; i <= _m; i++) {
      int x = Decode(), y = Decode();
      if (x == y) continue;
      qV.push_back(x), qV.push_back(y), add_edge(x, y), add_edge(y, x);
    }
    Bvt(), tim = tot = 0;
    for (auto i : qV) dfn[i] = low[i] = col[i] = 0;
    int fl = 1, x;
    for (auto i : qV)
      if (!dfn[i]) tarjan(i, 0);
    for (auto i : qV)
      if (!col[i]) ++tot, find(i);
    for (auto i : qV)
      if (vis[i]) x = i;
    for (auto i : qV)
      if (vis[i] && col[i] != col[x]) fl = 0;
    for (int i = 2; i <= e_num; i += 2)
      if (bri[i]) bri[i] = bri[i ^ 1] = 0;
    puts(fl ? "YES" : "NO"), R = (R + fl * T) % n;
    for (auto i : qV) vis[i] = head[i] = 0;
    e_num = 1;
  }
  return 0;
}
