#include <bits/stdc++.h>
using namespace std;
const int RLEN = 1 << 20 | 1;
inline char gc() {
  static char ibuf[RLEN], *ib, *ob;
  (ib == ob) && (ob = (ib = ibuf) + fread(ibuf, 1, RLEN, stdin));
  return (ib == ob) ? EOF : *ib++;
}
inline int read() {
  char ch = gc();
  int res = 0;
  bool f = 1;
  while (!isdigit(ch)) f ^= ch == '-', ch = gc();
  while (isdigit(ch)) res = (res + (res << 2) << 1) + (ch ^ 48), ch = gc();
  return f ? res : -res;
}
inline int readstring(char *s) {
  int top = 0;
  char ch = gc();
  while (isspace(ch)) ch = gc();
  while (!isspace(ch) && ch != EOF) s[++top] = ch, ch = gc();
  return top;
}
template <class tp>
inline void chemx(tp &a, tp b) {
  a < b ? a = b : 0;
}
template <class tp>
inline void chemn(tp &a, tp b) {
  a > b ? a = b : 0;
}
const int N = 300005;
int n, m, q;
namespace G2 {
int adj[N], nxt[N << 1], to[N << 1], cnt = 1;
int del[N << 2], num, rt;
int low[N], dfn[N], tim, stk[N], top, ecnt, id[N];
inline void add(int u, int v) {
  nxt[++cnt] = adj[u], adj[u] = cnt, to[cnt] = v;
}
inline void addedge(int u, int v) {
  if (u == rt || v == rt) return;
  del[++num] = u, del[++num] = v;
  add(u, v), add(v, u);
}
void dfs(int u, int fa) {
  stk[++top] = u;
  del[++num] = u;
  dfn[u] = low[u] = ++tim;
  for (int e = adj[u]; e; e = nxt[e])
    if (e != (fa ^ 1)) {
      int v = to[e];
      if (dfn[v])
        chemn(low[u], dfn[v]);
      else
        dfs(v, e), chemn(low[u], low[v]);
    }
  if (low[u] >= dfn[u]) {
    int tmp;
    ecnt++;
    do {
      tmp = stk[top--];
      id[tmp] = ecnt;
    } while (tmp != u);
  }
}
inline int solve(int *a, int _n) {
  top = tim = ecnt = 0;
  for (int i = 1; i <= _n; i++)
    if (!dfn[a[i]]) dfs(a[i], 0);
  int res = 1;
  for (int i = 1; i <= _n; i++)
    if (id[a[i]] != id[a[1]]) res = 0;
  while (num) {
    int u = del[num--];
    adj[u] = 0, dfn[u] = low[u] = id[u] = 0;
  }
  cnt = 1;
  return res;
}
}  // namespace G2
namespace T1 {
vector<int> e[N];
int in[N], fa[N], top[N], siz[N], son[N], vis[N], dep[N], dfn, rt, num;
inline void addedge(int u, int v) { e[u].push_back(v); }
void dfs(int u) {
  vis[u] = 1;
  for (int &v : e[u])
    if (!vis[v]) {
      dfs(v);
    }
}
void dfs1(int u) {
  siz[u] = 1;
  for (int &v : e[u])
    if (v != fa[u]) {
      fa[v] = u, dep[v] = dep[u] + 1;
      dfs1(v), siz[u] += siz[v];
      if (siz[v] > siz[son[u]]) son[u] = v;
    }
}
void dfs2(int u, int tp) {
  in[u] = ++dfn, top[u] = tp;
  if (son[u]) dfs2(son[u], tp);
  for (int &v : e[u])
    if (v != fa[u] && v != son[u]) {
      dfs2(v, v);
    }
}
inline int Lca(int u, int v) {
  while (top[u] != top[v]) {
    if (dep[top[u]] < dep[top[v]]) swap(u, v);
    u = fa[top[u]];
  }
  return dep[u] < dep[v] ? u : v;
}
inline void build() {
  rt = num + 1;
  G2::rt = rt;
  for (int i = 1; i <= num; i++)
    if (!vis[i]) e[rt].push_back(i), dfs(i);
  dfs1(rt), dfs2(rt, rt);
}
int stk[N];
inline bool comp(int a, int b) { return in[a] < in[b]; }
inline void buildvt(int *a, int n) {
  sort(a + 1, a + n + 1, comp);
  int top = 0;
  for (int i = 1; i <= n; i++) {
    int u = a[i];
    if (top) {
      int lca = Lca(u, stk[top]);
      if (in[lca] < in[stk[top]]) {
        while (top > 1 && in[lca] < in[stk[top - 1]])
          G2::addedge(stk[top - 1], stk[top]), top--;
        G2::addedge(lca, stk[top--]);
        if (stk[top] != lca) stk[++top] = lca;
      }
    }
    stk[++top] = u;
  }
  while (top > 1) G2::addedge(stk[top - 1], stk[top]), top--;
}
}  // namespace T1
int id[N];
namespace G1 {
int adj[N], nxt[N << 1], to[N << 1], cnt = 1;
int dfn[N], low[N], stk[N], top, ecnt, tim;
inline void add(int u, int v) {
  nxt[++cnt] = adj[u], adj[u] = cnt, to[cnt] = v;
}
inline void addedge(int u, int v) { add(u, v), add(v, u); }
void dfs(int u, int fa) {
  stk[++top] = u;
  dfn[u] = low[u] = ++tim;
  for (int e = adj[u]; e; e = nxt[e])
    if (e != (fa ^ 1)) {
      int v = to[e];
      if (dfn[v])
        chemn(low[u], dfn[v]);
      else
        dfs(v, e), chemn(low[u], low[v]);
    }
  if (low[u] >= dfn[u]) {
    int tmp;
    ecnt++;
    do {
      tmp = stk[top--];
      id[tmp] = ecnt;
    } while (tmp != u);
  }
}
inline void build() {
  T1::num = ecnt;
  for (int u = 1; u <= n; u++) {
    for (int e = adj[u]; e; e = nxt[e]) {
      int v = to[e];
      if (id[v] != id[u]) T1::addedge(id[u], id[v]);
    }
  }
}
}  // namespace G1
int last;
int a[N * 3], nd[N];
int main() {
  n = read(), m = read(), q = read();
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read();
    G1::addedge(u, v);
  }
  for (int i = 1; i <= n; i++)
    if (!G1::dfn[i]) G1::dfs(i, 0);
  G1::build();
  T1::build();
  for (int tt = 1; tt <= q; tt++) {
    int _n = read(), _m = read(), tot = 0;
    for (int i = 1; i <= _n; i++) {
      int u = (read() + last) % n;
      if (u == 0) u = n;
      a[++tot] = id[u], nd[i] = id[u];
    }
    for (int i = 1; i <= _m; i++) {
      int u = (read() + last) % n, v = (read() + last) % n;
      if (!u) u = n;
      if (!v) v = n;
      u = id[u], v = id[v];
      G2::addedge(u, v), a[++tot] = u, a[++tot] = v;
    }
    sort(a + 1, a + tot + 1);
    tot = unique(a + 1, a + tot + 1) - a - 1;
    T1::buildvt(a, tot);
    int res = G2::solve(nd, _n);
    puts(res ? "YES" : "NO");
    if (res) last = (last + tt) % n;
  }
}
