#include <bits/stdc++.h>
using namespace std;
int A[300003], B[300003], C[300003], O, P, Q, S[300003], T, a[300003],
    b[600006], c[600006], d[300003], e[300003], f[600006][20], g[300003],
    h[600006], k[300003], m, n, o[600006 + 300003], p, q, s, t;
inline void _e(int u, int v) {
  b[++t] = a[u], c[a[u] = t] = v, b[++t] = a[v], c[a[v] = t] = u;
}
inline bool _d(int u, int v) { return g[u] < g[v]; }
inline int _c(int u, int v) {
  return (u = g[u]) > (v = g[v]) ? u ^= v ^= u ^= v : 0,
         g[f[u][h[v - u + 1]]] < g[f[v - (1 << h[v - u + 1]) + 1][h[v - u + 1]]]
             ? f[u][h[v - u + 1]]
             : f[v - (1 << h[v - u + 1]) + 1][h[v - u + 1]];
}
void _b(int u) {
  for (int& i = a[*f[g[u] = ++t] = u]; i; i = b[i]) _b(i), *f[++t] = u;
}
void _a(int u, int v, int* w) {
  d[o[p++] = u] = e[u] = ++t;
  for (int& i = a[u]; i; i = b[i])
    if (i == v)
      continue;
    else if (!d[c[i]])
      _a(c[i], i ^ 1, w);
    else if (e[c[i]])
      e[u] = min(d[c[i]], e[u]);
  if (d[u] == e[u])
    for (s++, o[p] = 0; o[p] != u;) w[o[--p]] = s;
  e[c[v]] = min(e[c[v]], e[u]), e[u] = 0;
}
int i, j, u, v;
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (i = t = 1; i <= m; i++) scanf("%d%d", &u, &v), _e(u, v);
  for (i = 1; i <= n; i++)
    if (!d[i]) _a(i, 0, k);
  for (i = 1, t = 0; i <= m; i++)
    if ((u = k[c[i << 1]]) != (v = k[c[i << 1 | 1]]))
      u < v ? u ^= v ^= u ^= v : 0, b[v] = a[u], a[u] = v;
  for (i = s, t = 1; i; d[i--] = 0)
    if (!g[i]) _b(i), t++;
  for (i = 2; i <= t; i++) h[i] = h[i >> 1] + 1;
  for (j = 1; 1 << j <= t; j++)
    for (i = 1; i + (1 << j) - 1 <= t; i++)
      f[i][j] = g[f[i][j - 1]] < g[f[i + (1 << j - 1)][j - 1]]
                    ? f[i][j - 1]
                    : f[i + (1 << j - 1)][j - 1];
  for (v = 1; v <= q; v++) {
    scanf("%d%d", &O, &P);
    for (i = 1, p = 0; i <= O; i++)
      scanf("%d", A + i), o[++p] = A[i] = k[(A[i] + Q - 1) % n + 1];
    for (i = t = 1; i <= P; i++)
      scanf("%d%d", B + i, C + i), o[++p] = B[i] = k[(B[i] + Q - 1) % n + 1],
                                   o[++p] = C[i] = k[(C[i] + Q - 1) % n + 1],
                                   _e(B[i], C[i]);
    sort(o + 1, o + p + 1, _d);
    for (i = 1, j = *o = 0; i <= p; i++)
      if (o[i] == o[i - 1])
        continue;
      else if (S[++T] = o[i], _c(o[j], o[i]) == o[j])
        o[++j] = o[i];
      else {
        while (_c(o[j - 1], o[i]) != o[j - 1]) _e(o[j - 1], o[j]), j--;
        if (!_c(o[i], o[j]))
          o[j] = o[i];
        else if (_c(o[i], o[j]) == o[j - 1])
          _e(o[j - 1], o[j]), o[j] = o[i];
        else
          _e(u = _c(o[i], o[j]), o[j]), S[++T] = o[j] = u, o[++j] = o[i];
      }
    while (--j) _e(o[j], o[j + 1]);
    for (_a(A[1], p = s = t = 0, d), i = 1; i < O; i++)
      if (d[A[i]] != d[A[i + 1]]) break;
    for (puts(i == O ? (Q += v) %= n, "YES" : "NO"); T; T--)
      a[S[T]] = d[S[T]] = 0;
  }
  return 0;
}
