#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const long long Inf = 1e10;
const int P = 1e9 + 7;
const int N = 1200005;
inline int IN() {
  int x = 0;
  int ch = 0, f = 0;
  for (ch = getchar(); ch != -1 && (ch < 48 || ch > 57); ch = getchar())
    f = (ch == '-');
  for (; ch >= 48 && ch <= 57; ch = getchar())
    x = (x << 1) + (x << 3) + ch - '0';
  return f ? (-x) : x;
}
int Pow(int x, int y, int p) {
  int a = 1;
  for (; y; y >>= 1, x = (long long)x * x % p)
    if (y & 1) a = (long long)a * x % p;
  return a;
}
int n, m, q, bel[N], cnt, Id[N];
set<int> ver;
vector<pair<int, int> > ori_e;
namespace Bicon {
vector<pair<int, int> > ori_e;
vector<int> e[N];
int n, m, st[N], ed[N], tim, tfa[19][N], *fa = tfa[0], dep[N];
int vis[N], A[N], K, stk[N], top;
void dfs(int x) {
  vis[x] = 1;
  st[x] = ++tim;
  for (int v : e[x]) {
    if (v == fa[x]) continue;
    dep[v] = dep[x] + 1;
    fa[v] = x;
    dfs(v);
  }
  ed[x] = tim;
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = (int)(18); i >= (int)(0); i--)
    if (dep[tfa[i][x]] >= dep[y]) x = tfa[i][x];
  if (x == y) return x;
  for (int i = (int)(18); i >= (int)(0); i--)
    if (tfa[i][x] ^ tfa[i][y]) x = tfa[i][x], y = tfa[i][y];
  return fa[x];
}
void build(int n_) {
  n = n_;
  m = ori_e.size();
  tim = 0;
  for (int i = (int)(0); i < (int)(m); i++) {
    int u = ori_e[i].first, v = ori_e[i].second;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (int i = (int)(1); i <= (int)(n); i++)
    if (!vis[i]) {
      dep[i] = 1;
      dfs(i);
    }
  ed[0] = n;
  for (int i = (int)(1); i <= (int)(18); i++)
    for (int j = (int)(1); j <= (int)(n); j++)
      tfa[i][j] = tfa[i - 1][tfa[i - 1][j]];
}
int cmp(const int &a, const int &b) { return st[a] < st[b]; }
int vir() {
  K = 0;
  ::ori_e.clear();
  for (auto i : ver) A[++K] = i;
  sort(A + 1, A + K + 1, cmp);
  int tmp = K;
  for (int i = (int)(1); i < (int)(tmp); i++) A[++K] = lca(A[i], A[i + 1]);
  A[++K] = 0;
  sort(A + 1, A + K + 1, cmp);
  K = unique(A + 1, A + K + 1) - (A + 1);
  top = 0;
  for (int i = (int)(1); i <= (int)(K); i++) Id[A[i]] = i - 1;
  for (int i = (int)(0); i < (int)(ori_e.size()); i++) {
    int ui = ori_e[i].first, vi = ori_e[i].second;
    ui = Id[ui], vi = Id[vi];
    ::ori_e.push_back(make_pair(ui, vi));
  }
  for (int i = (int)(1); i <= (int)(K); i++) {
    int u = i;
    while (top && st[A[u]] > ed[A[stk[top]]]) --top;
    if (top && A[u] && A[stk[top]])
      ::ori_e.push_back(make_pair(u - 1, stk[top] - 1));
    stk[++top] = u;
  }
  return K - 1;
}
}  // namespace Bicon
long long last;
void rot(int &u) { u = (u + last - 1) % n + 1; }
int seq[N], tot;
namespace Graph {
vector<pair<int, int> > ori_e;
vector<int> e[N];
int n, vis[N], fa[N], f[N], T[N], dep[N], m, bel[N], cnt;
void dfs(int x) {
  vis[x] = 1;
  for (auto v : e[x])
    if (!vis[v]) {
      fa[v] = x;
      dep[v] = dep[x] + 1;
      dfs(v);
    }
}
int get(int x) {
  if (f[x] == x) return x;
  return f[x] = get(f[x]);
}
void build(int n_) {
  n = n_;
  m = ori_e.size();
  for (int i = (int)(1); i <= (int)(n); i++) e[i].clear();
  for (int i = (int)(1); i <= (int)(n); i++) {
    vis[i] = fa[i] = T[i] = 0;
    dep[i] = 1;
    f[i] = i;
  }
  for (int i = (int)(0); i < (int)(m); i++) {
    int u = ori_e[i].first, v = ori_e[i].second;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (int i = (int)(1); i <= (int)(n); i++)
    if (!vis[i]) dfs(i);
  for (int i = (int)(0); i < (int)(m); i++) {
    int u = ori_e[i].first, v = ori_e[i].second;
    if (v == fa[u]) swap(u, v);
    if (u == fa[v] && !T[v]) {
      T[v] = 1;
      continue;
    }
    while (1) {
      int du = get(u), dv = get(v);
      if (du == dv) break;
      if (dep[du] < dep[dv]) {
        swap(u, v);
        swap(du, dv);
      }
      f[du] = fa[du];
      u = fa[du];
    }
  }
  cnt = 0;
  for (int i = (int)(1); i <= (int)(n); i++)
    if (get(i) == i) bel[i] = ++cnt;
  for (int i = (int)(1); i <= (int)(n); i++) bel[i] = bel[get(i)];
}
int Query() {
  for (int i = (int)(1); i <= (int)(tot); i++) seq[i] = bel[Id[seq[i]]];
  for (int i = (int)(1); i <= (int)(tot); i++)
    if (seq[i] != seq[1]) return 0;
  return 1;
}
void Into() {
  for (int i = (int)(1); i <= (int)(n); i++)
    if (get(i) == i && fa[i]) {
      Bicon::ori_e.push_back(make_pair(bel[i], bel[fa[i]]));
    }
}
}  // namespace Graph
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = (int)(1); i <= (int)(m); i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    Graph::ori_e.push_back(make_pair(x, y));
  }
  Graph::build(n);
  Graph::Into();
  cnt = Graph::cnt;
  for (int i = (int)(1); i <= (int)(n); i++) bel[i] = Graph::bel[i];
  Bicon::build(cnt);
  for (int gtw = (int)(1); gtw <= (int)(q); gtw++) {
    Bicon::ori_e.clear();
    int ni = IN(), mi = IN();
    ver.clear();
    tot = ni;
    for (int i = (int)(1); i <= (int)(ni); i++) {
      int xi = IN();
      rot(xi);
      seq[i] = bel[xi];
      ver.insert(bel[xi]);
    }
    for (int i = (int)(1); i <= (int)(mi); i++) {
      int ui = IN(), vi = IN();
      rot(ui), rot(vi);
      ui = bel[ui], vi = bel[vi];
      ver.insert(ui);
      ver.insert(vi);
      Bicon::ori_e.push_back(make_pair(ui, vi));
    }
    int tmp = Bicon::vir();
    Graph::ori_e = ori_e;
    Graph::build(tmp);
    int Ans = Graph::Query();
    if (Ans) last += gtw;
    puts(Ans ? "YES" : "NO");
  }
  return 0;
}
