#include <bits/stdc++.h>
using namespace std;
char cb[1 << 16], *cs = cb, *ct = cb;
void read(int &res) {
  char ch;
  for (; !isdigit(
           ch = (cs == ct && (ct = (cs = cb) + fread(cb, 1, 1 << 16, stdin),
                             cs == ct)
                     ? 0
                     : *cs++));)
    ;
  for (res = ch - '0';
       isdigit(ch = (cs == ct && (ct = (cs = cb) + fread(cb, 1, 1 << 16, stdin),
                                 cs == ct)
                         ? 0
                         : *cs++));
       res = res * 10 + ch - '0')
    ;
}
int n, m, q;
namespace Decode {
int R = 0;
int rotate(int element) {
  element = (element + R) % n;
  if (element == 0) {
    element = n;
  }
  return element;
}
};  // namespace Decode
int info[900005], Prev[900005 << 1], to[900005 << 1], cnt_e = 1;
void Node(int u, int v) {
  Prev[++cnt_e] = info[u], info[u] = cnt_e, to[cnt_e] = v;
}
int dfn[900005], low[900005], tot, sta[900005], c[900005], scc;
void dfs0(int u, int ff) {
  dfn[u] = low[u] = ++tot;
  sta[++sta[0]] = u;
  for (int i = info[u], v; i; i = Prev[i])
    if (i ^ ff) {
      v = to[i];
      if (!dfn[v])
        dfs0(v, i ^ 1), low[u] = min(low[u], low[v]);
      else
        low[u] = min(low[u], dfn[v]);
    }
  if (low[u] == dfn[u]) {
    scc++;
    for (int t = -1; t != u;) {
      t = sta[sta[0]--];
      c[t] = scc;
    }
  }
}
vector<int> G[900005];
int sz[900005], tp[900005], fa[900005], son[900005], dep[900005], X[900005],
    A[900005], B[900005], st[900005];
void dfs1(int u, int ff) {
  dep[u] = dep[fa[u] = ff] + (sz[u] = 1);
  st[u] = ++tot;
  for (int v : G[u])
    if (v != ff)
      dfs1(v, u), sz[u] += sz[v], (sz[son[u]] < sz[v]) && (son[u] = v);
}
void dfs2(int u, int ff) {
  if (son[u]) tp[son[u]] = tp[u], dfs2(son[u], u);
  for (int v : G[u])
    if (v != ff && v != son[u]) dfs2(tp[v] = v, u);
}
int Lca(int u, int v) {
  for (; tp[u] ^ tp[v]; u = fa[tp[u]])
    if (dep[tp[u]] < dep[tp[v]]) swap(u, v);
  return dep[u] < dep[v] ? u : v;
}
int fir[900005], nxt[900005 << 4], tar[900005 << 4], cnte = 1;
void add(int u, int v) { nxt[++cnte] = fir[u], fir[u] = cnte, tar[cnte] = v; }
bool cmp(const int &u, const int &v) { return st[u] < st[v]; }
int bl[900005];
void dfs3(int u, int ff) {
  dfn[u] = low[u] = ++tot;
  sta[++sta[0]] = u;
  for (int i = fir[u], v; i; i = nxt[i])
    if (i ^ ff) {
      v = tar[i];
      if (!dfn[v])
        dfs3(v, i ^ 1), low[u] = min(low[u], low[v]);
      else
        low[u] = min(low[u], dfn[v]);
    }
  if (low[u] == dfn[u]) {
    scc++;
    for (int t = -1; t != u;) {
      bl[t = sta[sta[0]--]] = scc;
    }
  }
}
int main() {
  read(n), read(m), read(q);
  for (int i = (1), LIM = (m); i <= LIM; i++) {
    int u, v;
    read(u), read(v);
    Node(u, v), Node(v, u);
  }
  for (int i = (1), LIM = (n); i <= LIM; i++)
    if (!dfn[i]) dfs0(i, 0);
  memset(dfn, 0, sizeof dfn);
  memset(low, 0, sizeof low);
  tot = 0;
  for (int i = (1), LIM = (n); i <= LIM; i++)
    for (int j = info[i], v; j; j = Prev[j])
      if (c[i] ^ c[to[j]]) G[c[i]].push_back(c[to[j]]);
  for (int i = (1), LIM = (scc); i <= LIM; i++)
    if (!fa[i]) dfs1(i, 0), dfs2(tp[i] = i, 0);
  tot = scc = 0;
  for (int V, E; q--;) {
    read(V), read(E);
    static int ar[900005 << 3] = {}, pt[900005], st[900005], tp = 0;
    for (int i = (1), LIM = (V); i <= LIM; i++)
      read(X[i]), X[i] = Decode::rotate(X[i]), ar[++ar[0]] = c[X[i]];
    for (int i = (1), LIM = (E); i <= LIM; i++) {
      read(A[i]), read(B[i]);
      A[i] = Decode::rotate(A[i]);
      B[i] = Decode::rotate(B[i]);
      if (c[A[i]] ^ c[B[i]])
        ar[++ar[0]] = c[A[i]], ar[++ar[0]] = c[B[i]], add(c[A[i]], c[B[i]]),
        add(c[B[i]], c[A[i]]);
    }
    sort(ar + 1, ar + 1 + ar[0], cmp);
    ar[0] = unique(ar + 1, ar + 1 + ar[0]) - ar - 1;
    for (int i = (1), LIM = (ar[0]); i <= LIM; i++) {
      if (tp) {
        int t = Lca(st[tp], ar[i]), p = 0;
        if (!t) {
          for (; tp; p = st[tp--])
            if (p) add(p, st[tp]), add(st[tp], p);
        } else {
          for (; tp && dep[st[tp]] > dep[t]; p = st[tp--])
            if (p) add(st[tp], p), add(p, st[tp]);
          if (st[tp] ^ t) st[++tp] = pt[++pt[0]] = t;
          if (p) add(st[tp], p), add(p, st[tp]);
        }
      }
      st[++tp] = pt[++pt[0]] = ar[i];
    }
    int rt = 0;
    for (; tp; rt = st[tp--])
      if (rt) add(rt, st[tp]), add(st[tp], rt);
    for (int i = (1), LIM = (pt[0]); i <= LIM; i++)
      if (!dfn[pt[i]]) dfs3(pt[i], 0);
    int hp = bl[c[X[1]]];
    for (int i = (1), LIM = (V); i <= LIM; i++)
      if (bl[c[X[i]]] != hp) {
        hp = -1;
        break;
      }
    static int T = 0;
    ++T;
    if (hp == -1)
      puts("NO");
    else
      puts("YES"), (Decode::R += T) %= n;
    for (int i = (1), LIM = (pt[0]); i <= LIM; i++)
      fir[pt[i]] = dfn[pt[i]] = low[pt[i]] = bl[pt[i]] = 0;
    ar[0] = pt[0] = tot = tp = scc = 0;
    cnte = 1;
  }
}
