#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool d = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') d = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return d ? x : -x;
}
inline unsigned long long rnd() {
  return ((unsigned long long)rand() << 30 ^ rand()) << 4 | rand() % 4;
}
const int N = 3e5 + 5;
int head[N], opt;
struct info {
  int to, nxt;
} e[N << 1];
void add(int x, int y) {
  e[++opt] = (info){y, head[x]};
  head[x] = opt;
  e[++opt] = (info){x, head[y]};
  head[y] = opt;
}
int S[N], TOP, co[N], cnt, dfn[N], DEP, low[N];
bool used[N];
void tarjan(int u, int pre) {
  dfn[u] = low[u] = ++DEP;
  S[++TOP] = u;
  used[u] = 1;
  for (int i = head[u]; i; i = e[i].nxt) {
    if ((i + 1) / 2 == pre) continue;
    int k = e[i].to;
    if (!dfn[k]) {
      tarjan(k, (i + 1) / 2);
      low[u] = min(low[u], low[k]);
    } else if (used[k])
      low[u] = min(low[u], dfn[k]);
  }
  if (low[u] == dfn[u]) {
    used[u] = 0;
    co[u] = ++cnt;
    while (S[TOP] != u) {
      co[S[TOP]] = cnt;
      used[S[TOP--]] = 0;
    }
    TOP--;
  }
}
vector<long long> v[N];
int dep[N], son[N], size[N], id[N], tot, st[N], top[N], fa[N], gs, ed[N];
bool vis[N];
void dfs(int u) {
  vis[u] = 1;
  dep[u] = dep[fa[u]] + 1;
  size[u] = 1;
  for (auto k : v[u]) {
    if (k == fa[u]) continue;
    fa[k] = u;
    dfs(k);
    size[u] += size[k];
    if (!son[u] || size[k] > size[son[u]]) son[u] = k;
  }
}
void dfs(int u, int t) {
  top[u] = t;
  st[u] = ++tot;
  id[u] = gs;
  if (son[u]) dfs(son[u], t);
  for (auto k : v[u]) {
    if (k == fa[u] || k == son[u]) continue;
    dfs(k, k);
  }
  ed[u] = tot;
}
int lca(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  return dep[x] < dep[y] ? x : y;
}
void init(int n) {
  for (int i = (int)(1); i <= (int)(n); i++)
    if (!dfn[i]) tarjan(i, 0);
  for (int u = (int)(1); u <= (int)(n); u++) {
    for (int i = head[u]; i; i = e[i].nxt) {
      int k = e[i].to;
      if (co[u] == co[k]) continue;
      v[co[u]].push_back(co[k]);
    }
  }
  for (int i = (int)(1); i <= (int)(cnt); i++)
    if (!vis[i]) {
      gs++;
      dfs(i);
      dfs(i, i);
    }
}
stack<int> ST;
bool cmp(int x, int y) {
  if (id[x] == id[y]) return st[x] < st[y];
  return id[x] < id[y];
}
bool check(int x, int y) { return st[x] <= st[y] && ed[x] >= ed[y]; }
int be[N];
int main() {
  int n = read(), m = read(), q = read(), R = 0;
  for (int i = (int)(1); i <= (int)(m); i++) add(read(), read());
  init(n);
  for (int i = (int)(1); i <= (int)(n); i++) be[i] = co[i];
  memset(head, 0, sizeof(head));
  opt = 0;
  for (int o = (int)(1); o <= (int)(q); o++) {
    int k = read();
    m = read();
    vector<long long> rv, vec;
    for (int i = (int)(1); i <= (int)(k); i++) {
      int x = (read() + R) % n;
      if (x == 0) x = n;
      x = be[x];
      rv.push_back(x);
      vec.push_back(x);
    }
    vector<pair<int, int> > ve;
    for (int i = (int)(1); i <= (int)(m); i++) {
      int x = (read() + R) % n, y = (read() + R) % n;
      if (x == 0) x = n;
      if (y == 0) y = n;
      x = be[x];
      y = be[y];
      if (x == y) continue;
      ve.push_back(make_pair(x, y));
      rv.push_back(x);
      rv.push_back(y);
    }
    sort(rv.begin(), rv.end());
    rv.erase(unique(rv.begin(), rv.end()), rv.end());
    sort(rv.begin(), rv.end(), cmp);
    int sz = (int)rv.size();
    for (int i = (int)(1); i <= (int)(sz - 1); i++) {
      if (id[rv[i]] != id[rv[i - 1]]) continue;
      rv.push_back(lca(rv[i], rv[i - 1]));
    }
    sort(rv.begin(), rv.end());
    rv.erase(unique(rv.begin(), rv.end()), rv.end());
    sort(rv.begin(), rv.end(), cmp);
    for (auto x : rv) co[x] = low[x] = dfn[x] = used[x] = 0;
    TOP = DEP = cnt = 0;
    int pre = -1;
    for (auto x : rv) {
      if (pre == -1 || id[x] != id[pre]) {
        while (ST.size()) ST.pop();
      }
      while (ST.size() && !check(ST.top(), x)) ST.pop();
      if (ST.size()) {
        add(ST.top(), x);
      }
      ST.push(x);
      pre = x;
    }
    for (auto x : ve) {
      add(x.first, x.second);
    }
    for (auto x : rv)
      if (!dfn[x]) tarjan(x, 0);
    int ssw = co[vec[0]];
    bool d = 1;
    for (auto x : vec)
      if (co[x] != ssw) d = 0;
    puts(d ? "YES" : "NO");
    for (auto x : rv) head[x] = 0;
    opt = 0;
    if (d) R = (R + o) % n;
  }
}
