#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1200100;
inline int read(int x = 0, bool f = 0, char ch = getchar()) {
  for (; !isdigit(ch); ch = getchar()) f = ch == '-';
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
  return f ? -x : x;
}
int n, m, q, tot = 1, top, r, tim, cnt, num;
int fi[N], ne[N], to[N], st[N];
int dfn[N], bl[N], low[N], l[N];
int Bl[N], x[N], y[N], de[N];
int a[N], b[N], d[N], fa[N][20];
bool bri[N];
vector<int> g[N];
inline void add(int x, int y) {
  ne[++tot] = fi[x];
  to[fi[x] = tot] = y;
  ne[++tot] = fi[y];
  to[fi[y] = tot] = x;
}
void tarjan(int x, int fa) {
  dfn[x] = low[x] = ++tim;
  bool f = 1;
  for (int i = fi[x]; i; i = ne[i])
    if (i ^ 1 ^ fa) {
      int y = to[i];
      if (!dfn[y]) {
        tarjan(y, i), low[x] = min(low[x], low[y]);
        if (low[y] > dfn[x]) bri[i] = bri[i ^ 1] = true;
      } else
        low[x] = min(low[x], dfn[y]);
    }
}
void dfs(int x) {
  bl[x] = cnt;
  for (int i = fi[x]; i; i = ne[i])
    if (!bl[to[i]] && !bri[i]) dfs(to[i]);
}
inline int getlca(int x, int y) {
  if (de[x] < de[y]) swap(x, y);
  for (int i = 18; ~i; --i)
    if (de[fa[x][i]] >= de[y]) x = fa[x][i];
  if (x == y) return x;
  for (int i = 18; ~i; --i)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
void Dfs(int x) {
  l[x] = ++num;
  de[x] = de[fa[x][0]] + 1;
  for (int i : g[x])
    if (i != fa[x][0]) {
      fa[i][0] = x;
      for (int j = 1; j <= 18; ++j) fa[i][j] = fa[fa[i][j - 1]][j - 1];
      Dfs(i);
    }
}
inline int dc(int x) {
  x = (x + r) % n;
  if (x == 0) x = n;
  return x;
}
inline void insert(int x) {
  if (top == 1) return st[++top] = x, void();
  int y = getlca(x, st[top]);
  if (y == st[top]) return st[++top] = x, void();
  while (top > 1 && l[st[top - 1]] >= l[y]) add(st[top - 1], st[top]), --top;
  if (st[top] != y) add(y, st[top]), st[top] = y;
  st[++top] = x;
}
void Tarjan(int x, int fa) {
  dfn[x] = low[x] = ++tim;
  bool f = 1;
  for (int i = fi[x]; i; i = ne[i])
    if (i ^ 1 ^ fa)
      if (to[i] ^ cnt) {
        int y = to[i];
        if (!dfn[y]) {
          Tarjan(y, i), low[x] = min(low[x], low[y]);
          if (low[y] > dfn[x]) bri[i] = bri[i ^ 1] = true;
        } else
          low[x] = min(low[x], dfn[y]);
      }
}
void DFS(int x) {
  Bl[x] = num;
  for (int i = fi[x]; i; i = ne[i])
    if (!Bl[to[i]] && !bri[i] && (to[i] != cnt)) DFS(to[i]);
}
int main() {
  n = read(), m = read(), q = read();
  for (int i = 1, x, y; i <= m; ++i) add(read(), read());
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) Tarjan(i, 0);
  for (int i = 1; i <= n; ++i)
    if (!bl[i]) ++cnt, dfs(i);
  for (int i = 1; i <= n; ++i)
    for (int j = fi[i]; j; j = ne[j])
      if (bl[to[j]] != bl[i]) g[bl[to[j]]].push_back(bl[i]);
  dfn[++cnt] = 1;
  de[cnt] = 1;
  for (int i = 1; i < cnt; ++i)
    if (!fa[i][0]) fa[i][0] = cnt, Dfs(i);
  memset(fi, 0, sizeof(fi));
  memset(dfn, 0, sizeof(dfn));
  memset(bri, 0, sizeof(bri));
  for (int i = 1; i <= q; ++i) {
    int k = read(), s = read(), c = k, nn = 0;
    tim = num = 0;
    tot = 1;
    for (int i = 1; i <= k; ++i) a[i] = dc(read()), b[i] = bl[a[i]];
    for (int i = 1; i <= s; ++i)
      b[++c] = bl[x[i] = dc(read())], b[++c] = bl[y[i] = dc(read())];
    sort(b + 1, b + c + 1, [](int x, int y) { return l[x] < l[y]; });
    c = unique(b + 1, b + c + 1) - b - 1;
    st[top = 1] = cnt;
    for (int i = 1; i <= c; ++i) insert(b[i]);
    while (top > 1) add(st[top - 1], st[top]), --top;
    for (int i = 1; i <= s; ++i)
      if (bl[x[i]] != bl[y[i]]) add(bl[x[i]], bl[y[i]]);
    for (int i = 1; i <= c; ++i)
      if (!dfn[b[i]]) Tarjan(b[i], 0);
    for (int i = 2; i <= c; ++i)
      if (!Bl[b[i]]) ++num, DFS(b[i]);
    int ans = Bl[bl[a[1]]];
    for (int i = 2; i <= k; ++i)
      if (Bl[bl[a[i]]] != ans) ans = -1;
    for (int i = 2; i <= tot; ++i)
      dfn[to[i]] = fi[to[i]] = bri[i] = Bl[to[i]] = 0;
    if (ans == -1)
      puts("NO");
    else
      puts("YES"), r = (r + i) % n;
  }
  return 0;
}
