#include <bits/stdc++.h>
using namespace std;
int n, m, Q, nn, mm, fl, x, y, ans;
int d[300005], U[300005], V[300005], FL[300005];
int ch[900005][2], rev[900005], fa[900005], o[900005], w[900005], v[900005];
bool isrt(int x) { return ch[fa[x]][0] != x && ch[fa[x]][1] != x; }
void up(int x) {
  w[x] = min(w[ch[x][0]], w[ch[x][1]]);
  w[x] = min(w[x], v[x]);
}
void rever(int x) {
  swap(ch[x][0], ch[x][1]);
  rev[x] ^= 1;
}
void goup(int x) {
  if (!isrt(x)) goup(fa[x]);
  if (rev[x]) {
    rever(ch[x][0]);
    rever(ch[x][1]);
    rev[x] = 0;
  }
  if (o[x]) {
    if (ch[x][0]) {
      o[ch[x][0]] += o[x];
      w[ch[x][0]] += o[x];
      v[ch[x][0]] += o[x];
    }
    if (ch[x][1]) {
      o[ch[x][1]] += o[x];
      w[ch[x][1]] += o[x];
      v[ch[x][1]] += o[x];
    }
    o[x] = 0;
  }
}
void rotate(int x) {
  int y = fa[x], i = ch[y][1] == x, j = i ^ 1;
  if (!isrt(y)) ch[fa[y]][ch[fa[y]][1] == y] = x;
  fa[x] = fa[y];
  fa[y] = x;
  fa[ch[x][j]] = y;
  ch[y][i] = ch[x][j];
  ch[x][j] = y;
  up(y);
  up(x);
}
void splay(int x) {
  goup(x);
  for (int y, z; !isrt(x);) {
    y = fa[x];
    z = fa[y];
    if (!isrt(y))
      if (ch[y][0] == x ^ ch[z][0] == y)
        rotate(x);
      else
        rotate(y);
    rotate(x);
  }
}
void access(int x) {
  for (int y = 0; x; y = x, x = fa[x]) {
    splay(x);
    ch[x][1] = y;
    up(x);
  }
}
void mkrt(int x) {
  access(x);
  splay(x);
  rever(x);
}
int ro(int x) {
  x = (x + ans) % n;
  if (x == 0) x = n;
  return x;
}
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = 0; i <= n; ++i) w[i] = v[i] = 10000000;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    if (x == y) continue;
    mkrt(x);
    mkrt(y);
    if (fa[x]) {
      ++o[y], ++w[y], ++v[y];
    } else {
      fa[x] = fa[y] = i + n;
    }
  }
  for (int I = 1; I <= Q; ++I) {
    scanf("%d%d", &nn, &mm);
    for (int i = 1; i <= nn; ++i) scanf("%d", &d[i]), d[i] = ro(d[i]);
    for (int i = 1; i <= mm; ++i) {
      scanf("%d%d", &U[i], &V[i]);
      U[i] = ro(U[i]);
      V[i] = ro(V[i]);
      if (U[i] == V[i]) continue;
      mkrt(U[i]);
      mkrt(V[i]);
      if (fa[U[i]]) {
        ++o[V[i]], ++w[V[i]], ++v[V[i]];
        FL[i] = 1;
      } else {
        fa[U[i]] = fa[V[i]] = n + m + i;
        FL[i] = 0;
        ch[n + m + i][0] = ch[n + m + i][1] = fa[n + m + i] = 0;
        rev[n + m + i] = v[n + m + i] = w[n + m + i] = o[n + m + i] = 0;
      }
    }
    fl = 1;
    for (int i = 2; i <= nn; ++i) {
      mkrt(d[1]);
      access(d[i]);
      splay(d[i]);
      if (!fa[d[1]] || !w[d[i]]) {
        fl = 0;
        break;
      }
    }
    if (fl)
      puts("YES"), (ans += I) %= n;
    else
      puts("NO");
    for (int i = mm; i; --i) {
      if (U[i] == V[i]) continue;
      if (FL[i]) {
        mkrt(U[i]);
        access(V[i]);
        splay(V[i]);
        --o[V[i]];
        --w[V[i]];
        --v[V[i]];
      } else {
        mkrt(U[i]);
        mkrt(i + n + m);
        fa[ch[i + n + m][1]] = 0;
        ch[i + n + m][1] = 0;
        mkrt(V[i]);
        mkrt(i + n + m);
        fa[ch[i + n + m][1]] = 0;
        ch[i + n + m][1] = 0;
      }
    }
  }
  return 0;
}
