#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005, MAXM = 600005;
int n, m, Q;
vector<int> ver[MAXN];
struct edge {
  int x, y;
  edge() { x = y = 0; }
  edge(int xx, int yy) { x = xx, y = yy; }
} e[MAXN];
struct graph {
  int h[MAXN], tot;
  int nxt[MAXM << 1], to[MAXM << 1];
  int dfn[MAXN], low[MAXN], cnt;
  int stk[MAXN], tp;
  int scc[MAXN], scc_cnt;
  graph() { tot = 1; }
  void add(int x, int y) {
    nxt[++tot] = h[x];
    to[tot] = y;
    h[x] = tot;
  }
  void add_edge(int x, int y) { add(x, y), add(y, x); }
  void tarjan(int u, int fa) {
    dfn[u] = low[u] = ++cnt;
    stk[++tp] = u;
    for (int i = h[u]; i; i = nxt[i])
      if ((i ^ 1) != fa) {
        int v = to[i];
        if (!dfn[v]) {
          tarjan(v, i);
          low[u] = min(low[u], low[v]);
        } else
          low[u] = min(low[u], dfn[v]);
      }
    if (dfn[u] == low[u]) {
      ++scc_cnt;
      int tmp;
      do {
        tmp = stk[tp--];
        scc[tmp] = scc_cnt;
      } while (tmp != u);
    }
  }
  void clear(vector<int> v) {
    tot = 1;
    cnt = 0;
    tp = 0;
    scc_cnt = 0;
    for (int x : v) dfn[x] = low[x] = scc[x] = h[x] = 0;
  }
  void get_tree() {
    for (int i = 1; i <= m; i++)
      if (scc[e[i].x] != scc[e[i].y]) {
        ver[scc[e[i].x]].push_back(scc[e[i].y]);
        ver[scc[e[i].y]].push_back(scc[e[i].x]);
      }
  }
} G, g;
int rt[MAXN];
int fa[MAXN][19], dfn[MAXN], dep[MAXN], cnt;
void dfs(int u, int ii) {
  dfn[u] = ++cnt;
  rt[u] = ii;
  for (int v : ver[u])
    if (v != fa[u][0]) {
      dep[v] = dep[u] + 1;
      fa[v][0] = u;
      dfs(v, ii);
    }
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 18; ~i; i--)
    if (dep[fa[x][i]] >= dep[y]) x = fa[x][i];
  if (x == y) return x;
  for (int i = 18; ~i; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
int decode(int x, int y) { return x + y > n ? x + y - n : x + y; }
inline int R() {
  int a = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') a = a * 10 + c - '0', c = getchar();
  return a;
}
bool cmp(const int &aa, const int &bb) { return dfn[aa] < dfn[bb]; }
vector<int> pos, v, vv;
vector<edge> te;
int stk[MAXN], tp;
int main() {
  n = R(), m = R(), Q = R();
  G.tot = 1;
  for (int i = 1, x, y; i <= m; i++) {
    x = R(), y = R();
    G.add_edge(x, y);
    e[i].x = x, e[i].y = y;
  }
  for (int i = 1; i <= n; i++)
    if (!G.dfn[i]) G.tarjan(i, 0);
  G.get_tree();
  for (int i = 1; i <= G.scc_cnt; i++)
    if (!dep[i]) rt[i] = 1, dep[i] = 1, dfs(i, i);
  for (int j = 1; j <= 18; j++)
    for (int i = 1; i <= n; i++) fa[i][j] = fa[fa[i][j - 1]][j - 1];
  for (int tt = 1, delta = 0, nn, mm; tt <= Q; tt++) {
    nn = R(), mm = R();
    pos.clear(), v.clear(), te.clear();
    for (int i = 1; i <= nn; i++) pos.push_back(G.scc[decode(R(), delta)]);
    for (int i = 1, x, y; i <= mm; i++) {
      x = decode(R(), delta);
      y = decode(R(), delta);
      x = G.scc[x], y = G.scc[y];
      if (x != y) te.push_back(edge(x, y));
    }
    v.push_back(1);
    for (int x : pos) v.push_back(x);
    for (edge x : te) v.push_back(x.x), v.push_back(x.y);
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    sort(v.begin(), v.end(), cmp);
    tp = 0;
    int nid = 0;
    vv = v;
    for (int i = 0; i < (int)v.size(); i++) {
      int x = v[i];
      if (rt[x] != nid) {
        while (tp > 1) g.add_edge(stk[tp - 1], stk[tp]), --tp;
        stk[tp = 1] = rt[x], nid = rt[x];
        if (rt[x] == x)
          continue;
        else
          vv.push_back(rt[x]);
      }
      int par = lca(x, stk[tp]);
      if (par != stk[tp]) {
        while (dep[stk[tp - 1]] > dep[par])
          g.add_edge(stk[tp - 1], stk[tp]), --tp;
        g.add_edge(par, stk[tp]);
        if (stk[tp - 1] == par)
          --tp;
        else
          stk[tp] = par, vv.push_back(par);
      }
      stk[++tp] = x;
    }
    while (tp > 1) g.add_edge(stk[tp - 1], stk[tp]), --tp;
    v = vv;
    for (edge x : te) g.add_edge(x.x, x.y);
    for (int x : v)
      if (!g.dfn[x]) g.tarjan(x, 0);
    int id = g.scc[pos[0]];
    bool ok = 1;
    for (int x : pos)
      if (g.scc[x] != id) ok = 0;
    puts(ok ? "YES" : "NO");
    if (ok) delta = (delta + tt) % n;
    g.clear(v);
  }
  return 0;
}
