#include <bits/stdc++.h>
using namespace std;
const int N = 300007;
int tp, a[N], n, m, Q, vis[N], di[N], r, sum, q[N], n1, m1, mo, od;
struct Gr_Tr {
  struct node {
    int to, next;
  } w[N << 1];
  vector<int> G[N];
  int dn[N], low[N], blo, cnt, tm, st[N], tope;
  int fa[N], size[N], son[N], d[N], top[N], h[N], ist[N], dfn[N], scc[N], rt[N];
  void add(int x, int y) {
    cnt++;
    w[cnt].to = y, w[cnt].next = h[x];
    h[x] = cnt;
  }
  void tarjan(int u, int las) {
    dn[u] = low[u] = ++tm;
    ist[u] = 1;
    st[++tope] = u;
    for (int i = h[u]; i != -1; i = w[i].next) {
      int e = w[i].to;
      if (i == (las ^ 1)) continue;
      if (!dn[e])
        tarjan(e, i), low[u] = min(low[u], low[e]);
      else if (ist[u])
        low[u] = min(low[u], dn[e]);
    }
    if (dn[u] == low[u]) {
      blo++;
      int y;
      do {
        y = st[tope--];
        scc[y] = blo;
        ist[y] = 0;
      } while (u ^ y);
    }
  }
  void DFS1(int u, int ff, int col) {
    size[u] = 1;
    fa[u] = ff;
    d[u] = d[ff] + 1;
    rt[u] = col;
    for (int e : G[u]) {
      if (e ^ ff) {
        DFS1(e, u, col);
        size[u] += size[e];
        if (size[e] > size[son[u]]) son[u] = e;
      }
    }
  }
  void DFS2(int u, int anc) {
    top[u] = anc;
    dfn[u] = ++sum;
    if (son[u]) DFS2(son[u], anc);
    for (int e : G[u]) {
      if (e != fa[u] && e != son[u]) DFS2(e, e);
    }
  }
  int Lca(int u, int v) {
    while (top[u] ^ top[v]) {
      d[top[u]] > d[top[v]] ? u = fa[top[u]] : v = fa[top[v]];
    }
    return d[u] < d[v] ? u : v;
  }
  void work() {
    int i, x, y, j;
    cnt = -1;
    memset(h, -1, sizeof(h));
    for (i = 1; i <= m; i++) scanf("%d%d", &x, &y), add(x, y), add(y, x);
    for (i = 1; i <= n; i++) {
      if (!dn[i]) tarjan(i, -1);
    }
    for (i = 1; i <= n; i++) {
      for (j = h[i]; j != -1; j = w[j].next) {
        int e = w[j].to;
        if (scc[e] ^ scc[i]) {
          G[scc[e]].push_back(scc[i]);
        }
      }
    }
    for (i = 1; i <= blo; i++) {
      if (!rt[i]) DFS1(i, 0, i), DFS2(i, i);
    }
  }
  void ask() {
    int bj = 0, i;
    for (i = 1; i <= tp; i++) {
      if (!dn[a[i]]) tarjan(a[i], -1);
    }
    for (i = 2; i <= n1; i++) {
      if (scc[di[i]] != scc[di[1]]) {
        bj = 1;
        break;
      }
    }
    bj ? puts("NO") : puts("YES");
    if (!bj) mo = (mo + od) % n;
    for (i = 1; i <= tp; i++)
      h[a[i]] = -1, vis[a[i]] = dn[a[i]] = low[a[i]] = scc[a[i]] = 0;
    tm = blo = 0;
  }
} G, gi;
bool cmp(int a, int b) { return G.dfn[a] < G.dfn[b]; }
inline void work(int &x, int R) { x = x + mo > n ? x + mo - n : x + mo; }
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  sum = 0;
  memset(gi.h, -1, sizeof(gi.h));
  G.work();
  int i, x, y;
  while (Q--) {
    od++;
    scanf("%d%d", &n1, &m1);
    sum = 0;
    gi.cnt = -1;
    for (i = 1; i <= n1; i++) {
      scanf("%d", &di[i]);
      work(di[i], mo);
      di[i] = G.scc[di[i]];
      if (!vis[di[i]]) vis[di[i]] = 1, a[++sum] = di[i];
    }
    for (i = 1; i <= m1; i++) {
      scanf("%d%d", &x, &y);
      work(x, mo), work(y, mo);
      x = G.scc[x], y = G.scc[y];
      gi.add(x, y), gi.add(y, x);
      if (!vis[x]) vis[x] = 1, a[++sum] = x;
      if (!vis[y]) vis[y] = 1, a[++sum] = y;
    }
    sort(a + 1, a + 1 + sum, cmp);
    r = 0, tp = sum;
    for (i = 1; i <= sum; i++) {
      if (G.rt[q[r]] != G.rt[a[i]] || r == 0) {
        while (r > 1) gi.add(q[r], q[r - 1]), gi.add(q[r - 1], q[r]), r--;
        q[r = 1] = G.rt[a[i]];
        if (!vis[G.rt[a[i]]])
          vis[G.rt[a[i]]] = 1, a[++tp] = G.rt[a[i]];
        else
          continue;
      }
      int lca = G.Lca(q[r], a[i]);
      while (G.dfn[q[r]] > G.dfn[lca]) {
        if (G.dfn[q[r - 1]] > G.dfn[lca])
          gi.add(q[r - 1], q[r]), gi.add(q[r], q[r - 1]), r--;
        else
          gi.add(lca, q[r]), gi.add(q[r], lca), q[r] = lca, a[++tp] = lca;
      }
      q[++r] = a[i];
    }
    while (r > 1) gi.add(q[r], q[r - 1]), gi.add(q[r - 1], q[r]), r--;
    gi.ask();
  }
}
