#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int bl[600050];
int he[600050], ne[600050 << 2], to[600050 << 2], tot = 1;
int a[600050], alv, ale;
struct node {
  int x, y;
} ed[600050];
inline void addedge(int x, int y) {
  to[++tot] = y;
  ne[tot] = he[x];
  he[x] = tot;
}
int dfn[600050], low[600050], cnt, st[600050], tp;
inline void tarjan(int g, int fa) {
  dfn[g] = low[g] = ++cnt;
  st[++tp] = g;
  for (int i = he[g]; i; i = ne[i]) {
    if (i == (fa ^ 1)) continue;
    if (dfn[to[i]])
      low[g] = min(low[g], dfn[to[i]]);
    else {
      tarjan(to[i], i);
      low[g] = min(low[g], low[to[i]]);
    }
  }
  if (dfn[g] == low[g]) {
    while (1) {
      int t = st[tp--];
      bl[t] = g;
      if (t == g) break;
    }
  }
}
int f[600050][20];
int L[600050], dep[600050];
inline bool cmp(const int &a, const int &b) { return L[a] < L[b]; }
inline void dfs1(int g, int fa) {
  dep[g] = dep[fa] + 1;
  L[g] = ++cnt;
  f[g][0] = fa;
  for (int i = he[g]; i; i = ne[i])
    if (!dep[to[i]]) dfs1(to[i], g);
}
inline int LCA(int x, int y) {
  if (dep[x] > dep[y]) swap(x, y);
  for (int i = 18; ~i; --i)
    if (dep[f[y][i]] >= dep[x]) y = f[y][i];
  if (x == y) return x;
  for (int i = 18; ~i; --i)
    if (f[x][i] != f[y][i]) x = f[x][i], y = f[y][i];
  return f[x][0];
}
vector<int> v[600050];
inline void added(int x, int y) {
  if (!x || !y) return;
  v[x].push_back(y);
  v[y].push_back(x);
}
int fr[600050];
inline void dfs(int g, int fa) {
  dfn[g] = low[g] = ++cnt;
  st[++tp] = g;
  for (int i = 0, t, x = 0; i < v[g].size(); ++i) {
    t = v[g][i];
    if (!x && t == fa) {
      x = 1;
      continue;
    }
    if (dfn[t])
      low[g] = min(low[g], dfn[t]);
    else
      dfs(t, g), low[g] = min(low[g], low[t]);
  }
  if (dfn[g] == low[g]) {
    while (1) {
      int t = st[tp--];
      fr[t] = g;
      if (t == g) break;
    }
  }
}
inline void del(int g) {
  dfn[g] = 0;
  for (int i = 0; i < v[g].size(); ++i)
    if (dfn[v[g][i]]) del(v[g][i]);
  v[g].clear();
}
int pd[600050];
inline int work() {
  sort(a + 1, a + alv + 1, cmp);
  alv = unique(a + 1, a + alv + 1) - a - 1;
  tp = 0;
  for (int i = 1, d, lca, las; i <= alv; ++i) {
    d = a[i];
    if (!tp) {
      st[++tp] = d;
      continue;
    }
    las = 0;
    lca = LCA(st[tp], d);
    las = 0;
    while (tp && dep[st[tp]] > dep[lca]) {
      added(st[tp], las);
      las = st[tp--];
    }
    added(lca, las);
    if (!tp || st[tp] != lca) st[++tp] = lca;
    st[++tp] = d;
  }
  --tp;
  while (tp) added(st[tp], st[tp + 1]), --tp;
  for (int i = 1; i <= ale; ++i) added(ed[i].x, ed[i].y);
  cnt = 0;
  for (int i = 1; i <= alv; ++i)
    if (!dfn[a[i]]) dfs(a[i], 0);
  int al = 0, ok = 1;
  for (int i = 1; i <= alv && !al; ++i)
    if (pd[a[i]]) al = fr[a[i]];
  for (int i = 1; i <= alv && ok; ++i)
    if (pd[a[i]] && fr[a[i]] != al) ok = 0;
  puts(ok ? "YES" : "NO");
  for (int i = 1; i <= alv; ++i)
    if (dfn[a[i]]) del(a[i]);
  return ok;
}
int R;
inline int rotate(int element) {
  element = (element + R) % n;
  if (element == 0) element = n;
  return element;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  tot = 1;
  for (int i = 1, x, y; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    addedge(x, y);
    addedge(y, x);
    ed[i] = (node){x, y};
  }
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) tarjan(i, 0);
  for (int i = 1; i <= n; ++i) he[i] = dfn[i] = 0;
  tot = 1;
  for (int i = 1; i <= m; ++i) {
    ed[i].x = bl[ed[i].x];
    ed[i].y = bl[ed[i].y];
    if (ed[i].x != ed[i].y)
      addedge(ed[i].x, ed[i].y), addedge(ed[i].y, ed[i].x);
  }
  cnt = 0;
  for (int i = 1; i <= n; ++i)
    if (!dep[bl[i]]) dfs1(bl[i], 0);
  for (int j = 1; j <= 18; ++j)
    for (int i = 1; i <= n; ++i) f[i][j] = f[f[i][j - 1]][j - 1];
  for (int i = 1; i <= q; ++i) {
    scanf("%d%d", &alv, &ale);
    for (int j = 1; j <= alv; ++j)
      scanf("%d", &a[j]), a[j] = rotate(a[j]), a[j] = bl[a[j]], pd[a[j]] = 1;
    for (int j = 1; j <= ale; ++j) {
      scanf("%d%d", &ed[j].x, &ed[j].y);
      ed[j].x = rotate(ed[j].x);
      ed[j].y = rotate(ed[j].y);
      ed[j].x = bl[ed[j].x];
      ed[j].y = bl[ed[j].y];
      if (ed[j].x == ed[j].y)
        --j, --ale;
      else
        a[++alv] = ed[j].x, a[++alv] = ed[j].y;
    }
    if (work()) R += i;
    R %= n;
    for (int j = 1; j <= alv; ++j) pd[a[j]] = 0;
  }
  return 0;
}
