#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
int dfn[MAXN], low[MAXN], tcnt = 1;
int fa[MAXN], par[30][MAXN];
stack<int> sta;
int find(int x) { return ((x == fa[x]) ? x : fa[x] = find(fa[x])); }
void dfs(int v, int pa, vector<int> *neii) {
  dfn[v] = low[v] = tcnt++;
  sta.push(v);
  int cnt = 0;
  for (int i = 0; i < neii[v].size(); i++) {
    int u = neii[v][i];
    if (u == pa) cnt++;
    if (cnt == 1 && u == pa) continue;
    if (!dfn[u]) {
      dfs(u, v, neii);
      low[v] = min(low[u], low[v]);
    } else {
      low[v] = min(dfn[u], low[v]);
    }
  }
  if (low[v] == dfn[v]) {
    while (!sta.empty() && sta.top() != v) {
      fa[find(sta.top())] = find(v);
      sta.pop();
    }
    sta.pop();
  }
}
vector<int> nei[MAXN];
vector<int> nnei[MAXN];
void built(int n) {
  for (int i = 0; i < n; i++) {
    int v = find(i);
    for (int j = 0; j < nei[i].size(); j++) {
      int u = find(nei[i][j]);
      if (u == v) continue;
      nnei[v].push_back(u);
      nnei[u].push_back(v);
    }
  }
  for (int i = 0; i < n; i++) {
    sort(nnei[i].begin(), nnei[i].end());
    nnei[i].erase(unique(nnei[i].begin(), nnei[i].end()), nnei[i].end());
  }
}
int rot[MAXN], dep[MAXN];
void dfs2(int v, int pa, int root, int depth = 1) {
  dfn[v] = tcnt++;
  par[0][v] = pa;
  dep[v] = depth;
  if (pa == -1) par[0][v] = v;
  rot[v] = root;
  for (int i = 0; i < nnei[v].size(); i++) {
    int u = nnei[v][i];
    if (u == pa) continue;
    dfs2(u, v, root, depth + 1);
  }
}
void ini(int n) {
  for (int i = 1; i < 25; i++) {
    for (int j = 0; j < n; j++) {
      par[i][j] = par[i - 1][par[i - 1][j]];
    }
  }
}
int lca(int u, int v) {
  if (dep[u] > dep[v]) swap(u, v);
  if (dep[u] != dep[v]) {
    for (int i = 23; i >= 0; i--) {
      if (dep[par[i][v]] > dep[u]) v = par[i][v];
    }
    v = par[0][v];
  }
  if (u == v) return u;
  for (int i = 23; i >= 0; i--) {
    if (par[i][v] != par[i][u]) {
      v = par[i][v];
      u = par[i][u];
    }
  }
  return par[0][v];
}
int realdfn[MAXN];
bool cmp(int x, int y) { return (realdfn[x] < realdfn[y]); }
int stac[MAXN];
int st, ed;
int realfa[MAXN];
vector<int> nwnei[MAXN];
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    x--, y--;
    nei[x].push_back(y);
    nei[y].push_back(x);
  }
  for (int i = 0; i < n + 1; i++) fa[i] = i;
  for (int i = 0; i < n; i++)
    if (!dfn[i]) dfs(i, -1, nei);
  built(n);
  memset(dfn, 0, sizeof dfn);
  memset(low, 0, sizeof low);
  tcnt = 1;
  for (int i = 0; i < n; i++) realfa[i] = find(i);
  for (int i = 0; i < n; i++)
    if (!dfn[i] && fa[i] == i) dfs2(i, -1, i);
  for (int i = 0; i < n; i++) realdfn[i] = dfn[i];
  ini(n);
  int R = 0;
  for (int T = 1; T <= q; T++) {
    vector<int> tset, alv;
    int nq, mq;
    scanf("%d %d", &nq, &mq);
    for (int i = 0; i < nq; i++) {
      int tmp;
      scanf("%d", &tmp);
      tmp = (tmp + R) % n;
      if (tmp == 0) tmp = n;
      tmp--;
      tmp = realfa[tmp];
      alv.push_back(rot[tmp]);
      tset.push_back(tmp);
      alv.push_back(tmp);
    }
    for (int i = 0; i < mq; i++) {
      int x, y;
      scanf("%d %d", &x, &y);
      x = (x + R) % n;
      if (x == 0) x = n;
      y = (y + R) % n;
      if (y == 0) y = n;
      x--, y--;
      x = realfa[x], y = realfa[y];
      alv.push_back(x);
      alv.push_back(y);
      alv.push_back(rot[x]);
      alv.push_back(rot[y]);
      nwnei[x].push_back(y);
      nwnei[y].push_back(x);
    }
    vector<int> aled;
    sort(alv.begin(), alv.end(), cmp);
    alv.erase(unique(alv.begin(), alv.end()), alv.end());
    while (ed > st) {
      stac[ed--] = 0;
    }
    stac[ed++] = alv[0];
    for (int i = 1; i < alv.size(); i++) {
      if (rot[alv[i]] != rot[stac[ed - 1]]) {
        while (ed > st + 1) {
          nwnei[stac[ed - 1]].push_back(stac[ed - 2]);
          nwnei[stac[ed - 2]].push_back(stac[ed - 1]);
          stac[ed--] = 0;
        }
        stac[ed--] = 0;
        stac[ed++] = alv[i];
      } else {
        int Lca = lca(alv[i], stac[ed - 1]);
        if (Lca == stac[ed - 1])
          stac[ed++] = alv[i];
        else {
          while (ed > 1 && dep[Lca] <= dep[stac[ed - 2]]) {
            nwnei[stac[ed - 1]].push_back(stac[ed - 2]);
            nwnei[stac[ed - 2]].push_back(stac[ed - 1]);
            stac[ed--] = 0;
          }
          if (Lca != stac[ed - 1]) {
            nwnei[Lca].push_back(stac[ed - 1]);
            nwnei[stac[ed - 1]].push_back(Lca);
            stac[ed - 1] = Lca;
            aled.push_back(Lca);
          }
          stac[ed++] = alv[i];
        }
      }
    }
    while (ed > st + 1) {
      nwnei[stac[ed - 1]].push_back(stac[ed - 2]);
      nwnei[stac[ed - 2]].push_back(stac[ed - 1]);
      stac[ed--] = 0;
    }
    stac[ed--] = 0;
    for (int i = 0; i < alv.size(); i++) {
      fa[alv[i]] = alv[i];
      low[alv[i]] = 0;
      dfn[alv[i]] = 0;
    }
    for (int i = 0; i < aled.size(); i++) {
      fa[aled[i]] = aled[i];
      low[aled[i]] = 0;
      dfn[aled[i]] = 0;
    }
    while (!sta.empty()) sta.pop();
    tcnt = 1;
    for (int i = 0; i < alv.size(); i++) {
      if (!dfn[alv[i]]) dfs(alv[i], -1, nwnei);
    }
    for (int i = 0; i < aled.size(); i++) {
      if (!dfn[aled[i]]) dfs(aled[i], -1, nwnei);
    }
    int tmp = find(tset[0]);
    bool flag = 0;
    for (int i = 1; i < tset.size(); i++) {
      if (find(tset[i]) != tmp) {
        flag = 1;
        break;
      }
    }
    for (int i = 0; i < alv.size(); i++) {
      nwnei[alv[i]].clear();
    }
    for (int i = 0; i < aled.size(); i++) {
      nwnei[aled[i]].clear();
    }
    if (!flag)
      cout << "YES\n";
    else
      cout << "NO\n";
    if (!flag) R = (R + T) % n;
  }
}
