#include <bits/stdc++.h>
using namespace std;
template <typename tp>
inline void read(tp& x) {
  x = 0;
  char tmp;
  bool key = 0;
  for (tmp = getchar(); !isdigit(tmp); tmp = getchar()) key = (tmp == '-');
  for (; isdigit(tmp); tmp = getchar()) x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x, tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x, tp y) {
  x = x < y ? y : x;
}
int n, m, q;
int R = 0;
void ro(int& element) {
  element = (element + R) % n;
  if (element == 0) element = n;
}
const int N = 300010;
struct edge {
  int la, b;
};
namespace tarjan {
edge con[N << 1];
int tot = 1, first[N];
void add(int from, int to) {
  con[++tot] = (edge){first[from], to};
  first[from] = tot;
}
void add_edge(int x, int y) {
  add(x, y);
  add(y, x);
}
int sta[N], top, dfn[N], low[N], *bel, bcnt;
void dfs(int pos, int fa) {
  sta[dfn[pos] = low[pos] = ++top] = pos;
  for (int i = first[pos]; i; i = con[i].la) {
    if ((i >> 1) == fa) continue;
    if (bel[con[i].b]) continue;
    if (!dfn[con[i].b])
      dfs(con[i].b, i >> 1), low[pos] = min(low[pos], low[con[i].b]);
    else
      low[pos] = min(low[pos], dfn[con[i].b]);
  }
  if (low[pos] == dfn[pos]) {
    ++bcnt;
    while (top >= dfn[pos]) bel[sta[top--]] = bcnt;
  }
}
void init(vector<int>& vec) {
  tot = 1;
  for (int i = (0); i <= ((int)vec.size() - 1); ++i) first[vec[i]] = 0;
  for (int i = (0); i <= ((int)vec.size() - 1); ++i)
    dfn[vec[i]] = low[vec[i]] = 0;
  bcnt = 0;
}
void calc(int* arr, vector<int>& vec) {
  bel = arr;
  for (int i = (0); i <= ((int)vec.size() - 1); ++i) arr[vec[i]] = 0;
  for (int i = (0); i <= ((int)vec.size() - 1); ++i)
    if (!dfn[vec[i]]) dfs(vec[i], 0);
}
}  // namespace tarjan
int bel[N];
pair<int, int> edg[N];
edge con[N << 1];
int tot, first[N];
void add(int from, int to) {
  con[++tot] = (edge){first[from], to};
  first[from] = tot;
}
const int MP = 20;
int anc[N][MP], vis[N], dep[N], dfn[N], dcnt;
void dfs(int pos, int fa) {
  dep[pos] = dep[fa] + 1;
  anc[pos][0] = fa;
  dfn[pos] = ++dcnt;
  vis[pos] = 1;
  for (int i = (1); i <= (MP - 1); ++i) {
    anc[pos][i] = anc[anc[pos][i - 1]][i - 1];
    if (!anc[pos][i]) break;
  }
  for (int i = first[pos]; i; i = con[i].la) {
    if (con[i].b == fa) continue;
    dfs(con[i].b, pos);
  }
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = (MP - 1); i >= (0); --i)
    if (dep[anc[x][i]] >= dep[y]) x = anc[x][i];
  if (x == y) return x;
  for (int i = (MP - 1); i >= (0); --i)
    if (anc[x][i] != anc[y][i]) x = anc[x][i], y = anc[y][i];
  return anc[x][0];
}
int arr[N], acnt, ecnt, col[N], sta[N], top, ne, nn;
pair<int, int> nedg[N * 2];
vector<int> vec, rec;
bool solve() {
  vec.clear(), rec.clear();
  top = 0;
  read(nn), read(ne);
  ecnt = ne;
  acnt = nn;
  for (int i = (1); i <= (acnt); ++i) {
    read(arr[i]), ro(arr[i]), arr[i] = bel[arr[i]];
    rec.push_back(arr[i]);
  }
  for (int i = (1); i <= (ne); ++i) {
    int x, y;
    read(x), read(y);
    ro(x), ro(y);
    x = bel[x], y = bel[y];
    nedg[i] = pair<int, int>(x, y);
    rec.push_back(x), rec.push_back(y);
  }
  sort(rec.begin(), rec.end(),
       [=](const int& a, const int& b) -> bool { return dfn[a] < dfn[b]; });
  sta[++top] = rec[0], vec.push_back(rec[0]);
  for (int i = (1); i <= ((int)rec.size() - 1); ++i) {
    if (rec[i] == rec[i - 1]) continue;
    int las = 0;
    while (top > 0 && lca(sta[top], rec[i]) != sta[top]) {
      if (las) nedg[++ecnt] = pair<int, int>(las, sta[top]);
      las = sta[top--];
    }
    if (las) {
      int tmp = lca(las, rec[i]);
      if (tmp) nedg[++ecnt] = pair<int, int>(las, tmp);
      if (tmp != sta[top]) sta[++top] = tmp, vec.push_back(tmp);
    }
    sta[++top] = rec[i], vec.push_back(rec[i]);
  }
  for (int i = (1); i <= (top - 1); ++i)
    nedg[++ecnt] = pair<int, int>(sta[i], sta[i + 1]);
  tarjan::init(vec);
  for (int i = (1); i <= (ecnt); ++i)
    tarjan::add_edge(nedg[i].first, nedg[i].second);
  tarjan::calc(col, vec);
  int v = col[arr[1]], key = 1;
  for (int i = (2); i <= (acnt); ++i)
    if (col[arr[i]] != v) key = 0;
  return key;
}
int main() {
  int x, y;
  read(n), read(m), read(q);
  vector<int> tmp;
  for (int i = (1); i <= (n); ++i) tmp.push_back(i);
  tarjan::init(tmp);
  for (int i = (1); i <= (m); ++i) {
    read(x), read(y);
    edg[i] = pair<int, int>(x, y);
    tarjan::add_edge(x, y);
  }
  tarjan::calc(bel, tmp);
  for (int i = (1); i <= (m); ++i) {
    x = edg[i].first, y = edg[i].second;
    x = bel[x], y = bel[y];
    if (x != y) add(x, y), add(y, x);
  }
  for (int i = (1); i <= (n); ++i)
    if (!vis[i]) dfs(i, 0);
  for (int i = (1); i <= (q); ++i) {
    if (solve())
      puts("YES"), R = (R + i) % n;
    else
      puts("NO");
  }
  return 0;
}
