#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod) {
  x += y;
  if (x >= mod) x -= mod;
}
void et() {
  puts("-1");
  exit(0);
}
vector<int> mpA[300105];
vector<pair<int, int> > mp[300105];
struct tj {
  int dfn[300105], sta[300105], low[300105], color = 0, ii = 0, cnt = 0,
                                             belong[300105];
  bool ins[300105];
  void tarjan(int x, int pid) {
    dfn[x] = low[x] = ++ii;
    sta[++cnt] = x;
    ins[x] = 1;
    for (auto child : mp[x])
      if (child.second != pid) {
        int v = child.first;
        if (!dfn[v]) {
          tarjan(v, child.second);
          low[x] = min(low[x], low[v]);
        } else if (ins[v]) {
          low[x] = min(low[x], dfn[v]);
        }
      }
    if (dfn[x] == low[x]) {
      ++color;
      int t;
      do {
        t = sta[cnt];
        cnt--;
        ins[t] = 0;
        belong[t] = color;
      } while (dfn[t] != low[t]);
    }
  }
} T;
int R;
void Rotate(int &element) {
  element = (element + R) % n;
  if (element == 0) {
    element = n;
  }
}
int pos[300105], d[300105], p[300105][20], orderId, ed[300105];
void dfs(int x, int pa) {
  p[x][0] = pa;
  pos[x] = ++orderId;
  d[x] = d[pa] + 1;
  for (int c : mpA[x])
    if (c != pa) dfs(c, x);
  ed[x] = ++orderId;
}
vector<pair<int, int> > ES;
vector<int> nodes, snodes;
set<int> relNodes;
int relSize;
vector<pair<int, int> > mp1[300105];
int dfn[300105], sta[300105], low[300105], color, ii, cnt, belong[300105], Id;
bool ins[300105];
void tarjan(int x, int pid) {
  dfn[x] = low[x] = ++ii;
  sta[++cnt] = x;
  ins[x] = 1;
  for (auto child : mp1[x])
    if (child.second != pid) {
      int v = child.first;
      if (!dfn[v]) {
        tarjan(v, child.second);
        low[x] = min(low[x], low[v]);
      } else if (ins[v]) {
        low[x] = min(low[x], dfn[v]);
      }
    }
  if (dfn[x] == low[x]) {
    ++color;
    int t;
    do {
      t = sta[cnt];
      cnt--;
      ins[t] = 0;
      belong[t] = color;
    } while (dfn[t] != low[t]);
  }
}
bool ckAns() {
  int col = -1;
  for (int x : nodes) {
    if (col == -1)
      col = belong[x];
    else {
      if (col != belong[x]) return 0;
    }
  }
  return 1;
}
void clearAll() {
  nodes.clear();
  snodes.clear();
  Id = 0;
  color = 0;
  ii = 0;
  cnt = 0;
  for (int x : relNodes) {
    mp1[x].clear();
    dfn[x] = 0;
    low[x] = 0;
    belong[x] = 0;
    ins[x] = 0;
  }
  relSize = 0;
  relNodes.clear();
}
int lca(int a, int b) {
  if (d[a] > d[b]) swap(a, b);
  int f = d[b] - d[a];
  for (int i = 0; (1 << i) <= f; i++)
    if ((1 << i) & f) b = p[b][i];
  if (a != b) {
    for (int i = 19; i >= 0; i--)
      if (p[a][i] != p[b][i]) {
        a = p[a][i];
        b = p[b][i];
      }
    a = p[a][0];
  }
  return a;
}
bool cmp(int a, int b) { return pos[a] < pos[b]; }
void addEdge(int u, int v) {
  mp1[u].push_back({v, ++Id});
  mp1[v].push_back({u, Id});
  relNodes.insert(u);
  relNodes.insert(v);
}
void dealLca() {
  sort(snodes.begin(), snodes.end(), cmp);
  relSize = unique(snodes.begin(), snodes.end()) - snodes.begin();
  for (int j = 1; j < relSize; j++) {
    int u = snodes[j - 1], v = snodes[j];
    int w = lca(u, v);
    if (w) snodes.push_back(w);
  }
  sort(snodes.begin(), snodes.end(), cmp);
  relSize = unique(snodes.begin(), snodes.end()) - snodes.begin();
  vector<int> sta;
  for (int(j) = 0; (j) < (int)(relSize); (j)++) {
    while (!sta.empty() && ed[snodes[j]] > ed[sta.back()]) {
      sta.pop_back();
    }
    if (!sta.empty()) {
      addEdge(sta.back(), snodes[j]);
    }
    sta.push_back(snodes[j]);
  }
}
void fmain() {
  int q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0, u, v; i < m; i++) {
    scanf("%d%d", &u, &v);
    if (u == v) continue;
    mp[u].push_back({v, ++Id});
    mp[v].push_back({u, Id});
    ES.push_back({u, v});
  }
  for (int(i) = 1; (i) <= (int)(n); (i)++)
    if (T.belong[i] == 0) T.tarjan(i, 0);
  set<pair<int, int> > cacheEd;
  for (auto p : ES) {
    int u = T.belong[p.first], v = T.belong[p.second];
    if (u == v) continue;
    if (u > v) swap(u, v);
    if (cacheEd.count({u, v})) continue;
    cacheEd.insert({u, v});
    mpA[u].push_back(v);
    mpA[v].push_back(u);
  }
  for (int(i) = 1; (i) <= (int)(T.color); (i)++)
    if (pos[i] == 0) {
      dfs(i, 0);
    }
  for (int j = 1; (1 << j) <= n; j++)
    for (int i = 1; i <= n; i++) p[i][j] = p[p[i][j - 1]][j - 1];
  for (int i = 1, tn, tm, tmp, u, v; i <= q; i++) {
    scanf("%d%d", &tn, &tm);
    clearAll();
    for (int(j) = 0; (j) < (int)(tn); (j)++) {
      scanf("%d", &tmp);
      Rotate(tmp);
      tmp = T.belong[tmp];
      nodes.push_back(tmp);
      relNodes.insert(tmp);
      snodes.push_back(tmp);
    }
    for (int(j) = 0; (j) < (int)(tm); (j)++) {
      scanf("%d%d", &u, &v);
      Rotate(u);
      Rotate(v);
      u = T.belong[u];
      v = T.belong[v];
      addEdge(u, v);
      snodes.push_back(u);
      snodes.push_back(v);
    }
    dealLca();
    for (int z : relNodes)
      if (belong[z] == 0) tarjan(z, 0);
    bool ok = ckAns();
    puts(ok ? "YES" : "NO");
    if (ok) (R += i) %= n;
  }
}
int main() {
  fmain();
  return 0;
}
