#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
int sgn(T x) {
  return x > 0 ? 1 : (x < 0 ? -1 : 0);
}
const long double pi = acos(-1.0);
const int N = 600100;
int n;
int m;
int Q;
int was[N];
int col[N];
vector<pair<int, int> > v[N];
int bad[2 * N];
vector<int> q;
int R = 0;
vector<pair<int, int> > imp;
vector<int> w[N];
int p[N];
int ea[N];
int eb[N];
int x[N];
int num[N];
int tree[N];
int ct;
int tin[N];
int tout[N];
int anc[N][20];
int cimp[N];
int COL[N];
int rotate(int x) {
  x = (x + R) % n;
  if (x == 0) x = n;
  return x;
}
int go(int x, int p) {
  if (was[x]) return 0;
  was[x] = 1;
  for (int i = 0; i < ((int)(v[x]).size()); i++) {
    int y = v[x][i].first;
    int z = v[x][i].second;
    if ((z ^ 1) == p || was[y] == 2) continue;
    bad[z] = 1;
    go(y, z);
  }
  was[x] = 2;
  q.push_back(x);
  return 0;
}
int go2(int x, int c) {
  if (was[x]) return 0;
  col[x] = c;
  was[x] = 1;
  for (int i = 0; i < ((int)(v[x]).size()); i++) {
    int y = v[x][i].first;
    int z = v[x][i].second;
    if (bad[z]) continue;
    go2(y, c);
  }
  return 0;
}
int build(int n) {
  q.clear();
  for (int i = 0; i < n; i++) was[i] = 0;
  for (int i = 0; i < n; i++) go(i, -1);
  for (int i = 0; i < n; i++) was[i] = 0;
  reverse((q).begin(), (q).end());
  int o = 0;
  for (int i = 0; i < ((int)(q).size()); i++) {
    int x = q[i];
    if (!was[x]) {
      go2(x, o);
      o++;
    }
  }
  return o;
}
int go3(int x, int p, int c) {
  tin[x] = ct++;
  tree[x] = c;
  was[x] = 1;
  anc[x][0] = p;
  for (int i = 0; i < 19; i++) anc[x][i + 1] = anc[anc[x][i]][i];
  for (int i = 0; i < ((int)(w[x]).size()); i++) {
    int y = w[x][i];
    if (y == p) continue;
    go3(y, x, c);
  }
  tout[x] = ct++;
  return 0;
}
int isanc(int a, int b) { return int(tin[a] <= tin[b] && tout[a] >= tout[b]); }
int lca(int a, int b) {
  int j = 19;
  while (!isanc(a, b))
    if (j == 0 || !isanc(anc[a][j], b))
      a = anc[a][j];
    else
      j--;
  return a;
}
int add(int x) {
  if (cimp[x] != ct) {
    cimp[x] = ct;
    imp.push_back(make_pair(tin[x], x));
  }
  return 0;
}
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    v[a].push_back(make_pair(b, 2 * i));
    v[b].push_back(make_pair(a, 2 * i + 1));
    ea[i] = a;
    eb[i] = b;
  }
  int o = build(n);
  for (int i = 0; i < m; i++)
    if (col[ea[i]] != col[eb[i]]) {
      w[col[ea[i]]].push_back(col[eb[i]]);
      w[col[eb[i]]].push_back(col[ea[i]]);
    }
  memset(was, 0, sizeof(was));
  int r = 0;
  for (int i = 0; i < o; i++)
    if (!was[i]) {
      go3(i, i, r);
      r++;
    }
  for (int i = 0; i < n; i++) COL[i] = col[i];
  ct = 0;
  for (int it = 0; it < Q; it++) {
    ct++;
    imp.clear();
    int ni, mi;
    scanf("%d%d", &ni, &mi);
    for (int i = 0; i < ni; i++) {
      scanf("%d", &x[i]);
      x[i] = rotate(x[i]);
      x[i] = COL[x[i] - 1];
      add(x[i]);
    }
    for (int i = 0; i < mi; i++) {
      scanf("%d%d", &ea[i], &eb[i]);
      ea[i] = rotate(ea[i]);
      eb[i] = rotate(eb[i]);
      ea[i] = COL[ea[i] - 1];
      eb[i] = COL[eb[i] - 1];
      if (ea[i] != eb[i]) {
        add(ea[i]);
        add(eb[i]);
      }
    }
    sort((imp).begin(), (imp).end());
    int cn = ((int)(imp).size());
    for (int i = 0; i + 1 < cn; i++) {
      int a = imp[i].second;
      int b = imp[i + 1].second;
      if (tree[a] == tree[b]) {
        int c = lca(a, b);
        add(c);
      }
    }
    sort((imp).begin(), (imp).end());
    cn = ((int)(imp).size());
    for (int i = 0; i < cn; i++) {
      num[imp[i].second] = i;
      v[i].clear();
    }
    for (int i = 0; i < cn; i++) {
      int a = imp[i].second;
      int b = imp[i].second;
      if (i > 0 && tree[imp[i - 1].second] == tree[imp[i].second])
        a = lca(imp[i].second, imp[i - 1].second);
      if (i + 1 < cn && tree[imp[i + 1].second] == tree[imp[i].second])
        b = lca(imp[i].second, imp[i + 1].second);
      if (isanc(a, b)) swap(a, b);
      if (a == imp[i].second) a = b;
      p[i] = num[a];
    }
    int e = 0;
    for (int i = 0; i < cn; i++)
      if (p[i] != i) {
        v[i].push_back(make_pair(p[i], e++));
        v[p[i]].push_back(make_pair(i, e++));
      }
    for (int i = 0; i < mi; i++) {
      int a = num[ea[i]];
      int b = num[eb[i]];
      v[a].push_back(make_pair(b, e++));
      v[b].push_back(make_pair(a, e++));
    }
    for (int i = 0; i < e; i++) bad[i] = 0;
    build(cn);
    int ok = 1;
    for (int i = 1; i < ni && ok; i++)
      if (col[num[x[i]]] != col[num[x[0]]]) ok = 0;
    if (ok) {
      printf("YES\n");
      R += it + 1;
      R %= n;
    } else
      printf("NO\n");
  }
  return 0;
}
