#include <bits/stdc++.h>
using namespace std;
struct Graph {
  int head[500010], to[500010 << 1], nxt[500010 << 1], node[500010], idx, cnt;
  Graph() { idx = 1; }
  void add_node(int x) { node[++cnt] = x; }
  void unique_node() {
    sort(node + 1, node + cnt + 1),
        cnt = unique(node + 1, node + 1 + cnt) - node - 1;
  }
  void add(int a, int b) { nxt[++idx] = head[a], to[idx] = b, head[a] = idx; }
  void clear() {
    idx = 1;
    for (int i = 1; i <= cnt; i++) head[node[i]] = 0;
    cnt = 0;
  }
} graph1, graph2, graph3;
namespace Dcc {
int tim, cnt, dep[500010], low[500010], bel[500010];
bool bri[500010 << 1], vis[500010];
void tarjan(int p, int from, Graph &graph) {
  dep[p] = low[p] = ++tim;
  for (int i = graph.head[p]; i; i = graph.nxt[i])
    if (!dep[graph.to[i]]) {
      tarjan(graph.to[i], i, graph), low[p] = min(low[p], low[graph.to[i]]);
      if (dep[p] < low[graph.to[i]]) bri[i] = bri[i ^ 1] = true;
    } else if ((i ^ 1) != from)
      low[p] = min(low[p], dep[graph.to[i]]);
}
void init(int p, int ord, Graph &graph) {
  bel[p] = ord, vis[p] = true;
  for (int i = graph.head[p]; i; i = graph.nxt[i])
    if ((!vis[graph.to[i]]) && (!bri[i])) init(graph.to[i], ord, graph);
}
int get_bel(Graph &graph) {
  for (int i = 1; i <= graph.cnt; i++)
    low[graph.node[i]] = dep[graph.node[i]] = bel[graph.node[i]] = 0,
    vis[graph.node[i]] = false;
  for (int i = 1; i <= graph.idx; i++) bri[i] = false;
  tim = 0;
  for (int i = 1; i <= graph.cnt; i++)
    if (!dep[graph.node[i]]) tarjan(graph.node[i], 0, graph);
  cnt = 0;
  for (int i = 1; i <= graph.cnt; i++)
    if (!vis[graph.node[i]]) cnt++, init(graph.node[i], cnt, graph);
  return cnt;
}
void exchange(Graph &in, Graph &out) {
  cnt = get_bel(in);
  for (int i = 2; i <= in.idx; i += 2)
    if (bel[in.to[i]] != bel[in.to[i + 1]])
      out.add(bel[in.to[i + 1]], bel[in.to[i]]),
          out.add(bel[in.to[i]], bel[in.to[i + 1]]);
  out.cnt = cnt;
}
}  // namespace Dcc
vector<int> node;
namespace Tree {
int cnt = 0, ord[500010], level[500010], rt[500010], fa[20][500010], top = 0,
    sta[500010], in[500010];
void dfs(int p, int from, int root, Graph &graph) {
  ord[p] = ++cnt, rt[p] = root, level[p] = level[from] + 1, fa[0][p] = from;
  for (int i = graph.head[p]; i; i = graph.nxt[i])
    if (graph.to[i] != from) dfs(graph.to[i], p, root, graph);
}
int find_lca(int a, int b) {
  if (level[a] > level[b]) swap(a, b);
  for (int i = 19; ~i; i--)
    if (level[b] - level[a] >= (1 << i)) b = fa[i][b];
  if (a == b) return a;
  for (int i = 19; ~i; i--)
    if (fa[i][a] != fa[i][b]) a = fa[i][a], b = fa[i][b];
  return fa[0][a];
}
bool cmp(const int &a, const int &b) { return ord[a] < ord[b]; }
void insert(int p, Graph &graph) {
  if (top < 1) {
    sta[++top] = p;
    return;
  }
  int lca = find_lca(p, sta[top]);
  if (lca == sta[top]) {
    sta[++top] = p;
    return;
  }
  while (top > 1 && level[sta[top - 1]] >= level[lca]) {
    graph.add_node(sta[top]), graph.add_node(sta[top - 1]);
    graph.add(sta[top - 1], sta[top]), graph.add(sta[top], sta[top - 1]), top--;
  }
  if (sta[top] != lca)
    graph.add(lca, sta[top]), graph.add(sta[top], lca), graph.add_node(lca),
        graph.add_node(sta[top]);
  sta[top] = lca, sta[++top] = p;
}
void init(Graph &graph) {
  for (int i = 1; i <= graph.cnt; i++)
    if (!level[i]) dfs(i, 0, i, graph);
  for (int i = 1; i <= 19; i++)
    for (int j = 1; j <= graph.cnt; j++) fa[i][j] = fa[i - 1][fa[i - 1][j]];
}
void get_tree(int *in, int k, Graph &graph) {
  sort(in + 1, in + k + 1, cmp);
  for (int l = 1, r = 1; l <= k; l = r + 1, r = l) {
    while (r < k && rt[in[r]] == rt[in[r + 1]]) r++;
    top = 0;
    for (int i = l; i <= r; i++) insert(in[i], graph);
    while (top > 1) {
      graph.add(sta[top - 1], sta[top]), graph.add(sta[top], sta[top - 1]);
      graph.add_node(sta[top - 1]), graph.add_node(sta[top]), top--;
    }
    if (l == r) graph.add_node(in[l]);
  }
}
}  // namespace Tree
int n, m, q, bel[500010], point[500010], point2[500010];
bool check(int n) {
  for (int i = 2; i <= n; i++)
    if (Dcc::bel[point[i]] != Dcc::bel[point[1]]) return false;
  return true;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) graph1.add_node(i);
  for (int i = 1, a, b; i <= m; i++)
    scanf("%d%d", &a, &b), graph1.add(a, b), graph1.add(b, a);
  Dcc::exchange(graph1, graph2);
  for (int i = 1; i <= n; i++) bel[i] = Dcc::bel[i];
  Tree::init(graph2);
  for (int i = 1, tmp1 = 0, many1, many2, tmp; i <= q; i++) {
    scanf("%d%d", &many1, &many2), tmp = 0;
    for (int j = 1; j <= many1; j++) {
      scanf("%d", &point[j]), point[j] = (point[j] + tmp1 - 1) % n + 1;
      point[j] = bel[point[j]], point2[++tmp] = point[j];
    }
    for (int j = 1, a, b; j <= many2; j++) {
      scanf("%d%d", &a, &b), a = (a + tmp1 - 1) % n + 1,
                             b = (b + tmp1 - 1) % n + 1;
      if (bel[a] != bel[b]) {
        graph3.add(bel[a], bel[b]), graph3.add(bel[b], bel[a]);
        graph3.add_node(bel[a]), graph3.add_node(bel[b]);
      }
      point2[++tmp] = bel[a], point2[++tmp] = bel[b];
    }
    sort(point2 + 1, point2 + tmp + 1),
        tmp = unique(point2 + 1, point2 + tmp + 1) - point2 - 1;
    Tree::get_tree(point2, tmp, graph3), graph3.unique_node();
    Dcc::get_bel(graph3);
    if (many1 == 1 || check(many1))
      printf("YES\n"), (tmp1 += i) %= n;
    else
      printf("NO\n");
    graph3.clear();
  }
}
