#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 0;
  char ch = getchar();
  while (!isdigit(ch)) f = ch == '-', ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
const int N = 300005;
int n, m, q, k;
int bh[N], bel[N];
struct Graph {
  static const int M = N * 2;
  int cnt, y[M], nxt[M], fst[N];
  void clear() { cnt = 1, memset(fst, 0, sizeof fst); }
  void clear(vector<int> &id) {
    cnt = 1;
    for (auto i : id) fst[i] = 0;
  }
  void add(int a, int b) { y[++cnt] = b, nxt[cnt] = fst[a], fst[a] = cnt; }
} g, g2;
map<int, int> Map[N];
namespace TJ {
int dfn[N], low[N], st[N], inst[N];
int vise[N];
int Time = 0, top = 0, cnt = 0;
void init(vector<int> &id, int ec) {
  Time = top = cnt = 0;
  for (auto i : id) dfn[i] = low[i] = inst[i] = bh[i] = 0;
  for (int i = (1); i <= (ec >> 1); i++) vise[i] = 0;
}
void Tarjan(int x) {
  dfn[x] = low[x] = ++Time;
  inst[x] = 1;
  st[++top] = x;
  for (int i = g.fst[x]; i; i = g.nxt[i]) {
    if (vise[i >> 1]) continue;
    vise[i >> 1] = 1;
    int y = g.y[i];
    if (!dfn[y]) {
      Tarjan(y);
      low[x] = min(low[x], low[y]);
    } else if (inst[y])
      low[x] = min(low[x], low[y]);
  }
  if (dfn[x] == low[x]) {
    bh[st[top]] = ++cnt;
    inst[st[top]] = 0;
    while (st[top--] != x) {
      bh[st[top]] = cnt;
      inst[st[top]] = 0;
    }
  }
}
void Main() {
  g.clear();
  for (int i = (1); i <= (m); i++) {
    int x = read(), y = read();
    g.add(x, y), g.add(y, x);
  }
  for (int i = (1); i <= (n); i++)
    if (!dfn[i]) Tarjan(i);
  k = cnt;
}
}  // namespace TJ
int fa[N][20], depth[N], I[N], CI = 0, ct[N], cntt = 0, root[N];
void dfs(int x, int pre, int d) {
  depth[x] = d, fa[x][0] = pre, I[x] = ++CI, ct[x] = cntt;
  for (int i = (1); i <= (19); i++) fa[x][i] = fa[fa[x][i - 1]][i - 1];
  for (int i = g2.fst[x]; i; i = g2.nxt[i]) {
    int y = g2.y[i];
    if (y != pre) dfs(y, x, d + 1);
  }
}
int LCA(int x, int y) {
  if (depth[x] < depth[y]) swap(x, y);
  for (int i = (19); i >= (0); i--)
    if (depth[x] - (1 << i) >= depth[y]) x = fa[x][i];
  if (x == y) return x;
  for (int i = (19); i >= (0); i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
int lastans = 0;
int getv() {
  int v = read();
  v = (v + lastans) % n;
  if (v == 0) v = n;
  return v;
}
bool cmpI(int a, int b) { return I[a] < I[b]; }
int visrt[N];
int st[N], top;
int main() {
  n = read(), m = read(), q = read();
  TJ::Main();
  g2.clear();
  for (int i = (2); i <= (g.cnt); i++) {
    int x = bh[g.y[i ^ 1]], y = bh[g.y[i]];
    if (x != y && !Map[x][y]) {
      Map[x][y] = 1;
      g2.add(x, y);
    }
  }
  for (int i = (1); i <= (k); i++)
    if (!I[i]) root[++cntt] = i, dfs(i, 0, 0);
  swap(bh, bel);
  for (int T = (1); T <= (q); T++) {
    int ni = read(), mi = read();
    vector<int> id, x, vid, tmp;
    vector<pair<int, int> > p;
    for (int i = (1); i <= (ni); i++) {
      int v = bel[getv()];
      x.push_back(v), id.push_back(v);
    }
    for (int i = (1); i <= (mi); i++) {
      int x = bel[getv()], y = bel[getv()];
      p.push_back(make_pair(x, y));
      id.push_back(x), id.push_back(y);
    }
    sort(id.begin(), id.end(), cmpI);
    id.resize(unique(id.begin(), id.end()) - id.begin());
    for (auto i : id)
      if (i == root[ct[i]]) visrt[i] = T;
    for (auto i : id)
      if (visrt[root[ct[i]]] != T) visrt[i] = T, tmp.push_back(root[ct[i]]);
    for (auto i : tmp) id.push_back(i);
    sort(id.begin(), id.end(), cmpI);
    vid = id;
    top = 0;
    for (int _ = (0); _ <= ((int)id.size() - 1); _++) {
      int x = id[_];
      if (top > 0) {
        int y = LCA(x, st[top]);
        while (top > 1 && depth[st[top - 1]] >= depth[y]) {
          p.push_back(make_pair(st[top], st[top - 1]));
          top--;
        }
        if (y != st[top]) {
          vid.push_back(y);
          p.push_back(make_pair(st[top], y));
          st[top] = y;
        }
      }
      st[++top] = x;
      if (_ == (int)id.size() - 1 || ct[x] != ct[id[_ + 1]]) {
        while (top > 1) {
          p.push_back(make_pair(st[top], st[top - 1]));
          top--;
        }
        top = 0;
      }
    }
    g.clear(vid);
    for (auto e : p) {
      g.add(e.first, e.second);
      g.add(e.second, e.first);
    }
    TJ::init(vid, g.cnt);
    for (auto i : vid)
      if (!TJ::dfn[i]) TJ::Tarjan(i);
    int flag = 0;
    for (auto i : x)
      if (bh[i] != bh[x.back()]) {
        flag = 1;
        break;
      }
    if (flag)
      puts("NO");
    else
      puts("YES"), lastans = (lastans + T) % n;
  }
  return 0;
}
