#include <bits/stdc++.h>
using namespace std;
const int N = 300005, M = 300005, LOGN = 21;
template <class T>
void read(T &x) {
  int sgn = 1;
  char ch;
  x = 0;
  for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
    ;
  if (ch == '-') ch = getchar(), sgn = -1;
  for (; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  x *= sgn;
}
template <class T>
void write(T x) {
  if (x < 0)
    putchar('-'), write(-x);
  else if (x < 10)
    putchar(x + '0');
  else
    write(x / 10), putchar(x % 10 + '0');
}
struct edge {
  int to, nxt;
};
struct graph {
  int V, head[N], cnt;
  edge g[M << 1];
  void init(int v) {
    V = v;
    for (int i = 0; i < v; i++) head[i] = -1;
    cnt = 0;
  }
  void addedge(int u, int v) {
    edge e = {v, head[u]};
    g[head[u] = cnt++] = e;
  }
  int low[N], dfn[N], bcc[N], tot, t;
  stack<int> stk;
  void dfs(int u, int fa) {
    low[u] = dfn[u] = ++tot;
    stk.push(u);
    for (int i = head[u]; ~i; i = g[i].nxt) {
      int v = g[i].to;
      if (i != fa) {
        if (!dfn[v])
          dfs(v, i ^ 1), low[u] = min(low[u], low[v]);
        else
          low[u] = min(low[u], dfn[v]);
      }
    }
    if (low[u] == dfn[u]) {
      for (;;) {
        int x = stk.top();
        bcc[x] = t, stk.pop();
        if (x == u) break;
      }
      t++;
    }
  }
  void get_bcc() {
    tot = t = 0;
    for (int i = 0; i < V; i++) low[i] = dfn[i] = 0;
    for (int i = 0; i < V; i++) {
      if (!dfn[i]) dfs(i, -1);
    }
  }
} g1, tree, g2;
int dep[N], euler[N << 1][LOGN], id[N], Log2[N << 1], cnt = 0;
void dfs(int u, int fa) {
  euler[id[u] = ++cnt][0] = u;
  for (int i = tree.head[u]; ~i; i = tree.g[i].nxt) {
    int v = tree.g[i].to;
    if (v != fa) {
      dep[v] = dep[u] + 1;
      dfs(v, u);
      euler[++cnt][0] = u;
    }
  }
}
void rmq_init() {
  for (int i = 1; i <= cnt; i++) {
    for (int j = 1; (1 << j) <= i; j++) {
      if (dep[euler[i][j - 1]] < dep[euler[i - (1 << (j - 1))][j - 1]])
        euler[i][j] = euler[i][j - 1];
      else
        euler[i][j] = euler[i - (1 << (j - 1))][j - 1];
    }
  }
  Log2[1] = 0;
  for (int i = 2; i <= cnt; i++) Log2[i] = Log2[i >> 1] + 1;
}
int lca(int u, int v) {
  int l = id[u], r = id[v];
  if (l > r) swap(l, r);
  int label = Log2[r - l + 1];
  if (dep[euler[r][label]] < dep[euler[l + (1 << label) - 1][label]])
    return euler[r][label];
  return euler[l + (1 << label) - 1][label];
}
int n, m, q, stk[N], R = 0, top = 0;
vector<int> vec, vec_v;
vector<pair<int, int> > vec_e;
bool cmp(int x, int y) { return id[x] < id[y]; }
int main() {
  read(n), read(m), read(q);
  g1.init(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    read(u), read(v);
    u--, v--;
    g1.addedge(u, v), g1.addedge(v, u);
  }
  g1.get_bcc();
  tree.init(g1.t + 1);
  for (int i = 0; i < n; i++) {
    for (int j = g1.head[i]; ~j; j = g1.g[j].nxt) {
      int u = i, v = g1.g[j].to;
      if (g1.bcc[u] != g1.bcc[v]) tree.addedge(g1.bcc[u], g1.bcc[v]);
    }
  }
  for (int i = 0; i <= g1.t; i++) dep[i] = 0;
  euler[id[g1.t] = ++cnt][0] = g1.t;
  for (int i = 0; i < g1.t; i++) {
    if (!dep[i]) {
      tree.addedge(g1.t, i), tree.addedge(i, g1.t);
      dep[i] = 1, dfs(i, g1.t);
      euler[++cnt][0] = g1.t;
    }
  }
  rmq_init();
  for (int i = 1; i <= q; i++) {
    vec.clear(), vec_v.clear(), vec_e.clear();
    int V, E;
    read(V), read(E);
    for (int j = 0; j < V; j++) {
      int u;
      read(u);
      u--, u = (u + R) % n;
      vec_v.push_back(g1.bcc[u]), vec.push_back(g1.bcc[u]);
    }
    for (int j = 0; j < E; j++) {
      int u, v;
      read(u), read(v);
      u--, u = (u + R) % n;
      v--, v = (v + R) % n;
      vec_e.push_back(make_pair(g1.bcc[u], g1.bcc[v]));
      vec_v.push_back(g1.bcc[u]), vec_v.push_back(g1.bcc[v]);
    }
    sort(vec_v.begin(), vec_v.end(), cmp);
    stk[top = 0] = g1.t;
    for (int j = 0; j < vec_v.size(); j++) {
      int p = lca(vec_v[j], stk[top]);
      while (top && id[stk[top - 1]] >= id[p]) {
        vec_e.push_back(make_pair(stk[top - 1], stk[top]));
        top--;
      }
      if (p != stk[top]) {
        vec_e.push_back(make_pair(p, stk[top]));
        stk[top] = p;
      }
      if (stk[top] != vec_v[j]) stk[++top] = vec_v[j];
    }
    while (top) {
      vec_e.push_back(make_pair(stk[top - 1], stk[top]));
      top--;
    }
    vec_v.clear();
    for (int j = 0; j < vec_e.size(); j++) {
      vec_v.push_back(vec_e[j].first);
      vec_v.push_back(vec_e[j].second);
    }
    sort(vec_v.begin(), vec_v.end());
    int s = unique(vec_v.begin(), vec_v.end()) - vec_v.begin();
    g2.init(s);
    for (int j = 0; j < vec_e.size(); j++) {
      if (vec_e[j].first == g1.t) continue;
      if (vec_e[j].second == g1.t) continue;
      int u = lower_bound(vec_v.begin(), vec_v.begin() + s, vec_e[j].first) -
              vec_v.begin();
      int v = lower_bound(vec_v.begin(), vec_v.begin() + s, vec_e[j].second) -
              vec_v.begin();
      g2.addedge(u, v), g2.addedge(v, u);
    }
    g2.get_bcc();
    bool flag = true;
    for (int j = 1; j < vec.size(); j++) {
      int u =
          lower_bound(vec_v.begin(), vec_v.begin() + s, vec[j]) - vec_v.begin();
      int v =
          lower_bound(vec_v.begin(), vec_v.begin() + s, vec[0]) - vec_v.begin();
      if (g2.bcc[u] != g2.bcc[v]) flag = false;
    }
    if (flag)
      puts("YES"), R = (R + i) % n;
    else
      puts("NO");
  }
  return 0;
}
