#include <bits/stdc++.h>
using namespace std;
const int Maxn = 300005;
vector<int> e[Maxn], ne[Maxn];
vector<pair<int, int>> edge, nedge;
int bl[Maxn], vis[Maxn], dep[Maxn], f[Maxn][20], st[Maxn], ed[Maxn], scc;
namespace A {
vector<pair<int, int>> E[Maxn];
int dfn[Maxn], low[Maxn], tmp[Maxn], scc;
void Tarjan(int x, int id) {
  static int cnt, Stack[Maxn], top;
  dfn[x] = low[x] = ++cnt;
  Stack[++top] = x;
  for (auto i : E[x]) {
    int y, eid;
    tie(y, eid) = i;
    if (eid == id) continue;
    if (!dfn[y])
      Tarjan(y, eid), low[x] = min(low[x], low[y]);
    else
      low[x] = min(low[x], dfn[y]);
  }
  if (dfn[x] == low[x]) {
    scc++;
    int t;
    do {
      t = Stack[top--];
      tmp[t] = scc;
    } while (t != x);
  }
}
void solve(vector<int> V, vector<pair<int, int>> edge) {
  scc = 0;
  for (int i : V) dfn[i] = 0, low[i] = 0, tmp[i] = 0, E[i].clear();
  for (auto i : edge) {
    static int cnt;
    if (i.first == i.second) continue;
    cnt++;
    E[i.first].emplace_back(i.second, cnt);
    E[i.second].emplace_back(i.first, cnt);
  }
  for (int i : V)
    if (!dfn[i]) Tarjan(i, 0);
}
}  // namespace A
void dfs(int x, int fa) {
  static int cnt;
  st[x] = ++cnt;
  f[x][0] = fa;
  dep[x] = dep[fa] + 1;
  for (int i = 1; i < 20; i++) f[x][i] = f[f[x][i - 1]][i - 1];
  for (int y : ne[x]) {
    if (y == fa) continue;
    dfs(y, x);
  }
  ed[x] = cnt;
}
int lca(int x, int y) {
  if (dep[x] < dep[y]) swap(x, y);
  for (int i = 19; ~i; i--)
    if (dep[f[x][i]] >= dep[y]) x = f[x][i];
  if (x == y) return x;
  for (int i = 19; ~i; i--)
    if (f[x][i] != f[y][i]) x = f[x][i], y = f[y][i];
  return f[x][0];
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  st[0] = 1;
  ed[0] = n;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x == y) continue;
    edge.emplace_back(x, y);
    e[x].push_back(y);
    e[y].push_back(x);
  }
  vector<int> a;
  for (int i = 1; i <= n; i++) a.push_back(i);
  A::solve(a, edge);
  scc = A::scc;
  for (int i = 1; i <= n; i++) bl[i] = A::tmp[i];
  for (auto i : edge) {
    int x, y;
    tie(x, y) = i;
    x = bl[x], y = bl[y];
    if (x == y) continue;
    nedge.emplace_back(x, y);
    ne[x].push_back(y);
    ne[y].push_back(x);
  }
  for (int i = 1; i <= scc; i++)
    if (!dep[i]) dfs(i, 0);
  for (int Q = 1; Q <= q; Q++) {
    static int cnt_yes = 0, Stack[Maxn], top;
    int N, M;
    scanf("%d%d", &N, &M);
    vector<int> a, v;
    vector<pair<int, int>> tedge;
    auto rotate = [&](int x) {
      x = (x + cnt_yes) % n;
      if (!x) x = n;
      return x;
    };
    auto cmp_dfn = [&](int x, int y) { return st[x] < st[y]; };
    auto In = [&](int x, int y) { return st[y] <= st[x] && ed[x] <= ed[y]; };
    for (int i = 1; i <= N; i++) {
      int x;
      scanf("%d", &x);
      x = bl[rotate(x)];
      a.push_back(x);
      v.push_back(x);
    }
    for (int i = 1; i <= M; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      x = rotate(x);
      y = rotate(y);
      x = bl[x], y = bl[y];
      if (x == y) continue;
      a.push_back(x);
      a.push_back(y);
      tedge.emplace_back(x, y);
    }
    sort(a.begin(), a.end(), cmp_dfn);
    a.erase(unique(a.begin(), a.end()), a.end());
    size_t sz = a.size();
    for (size_t i = 0; i + 1 < sz; i++) {
      int x = lca(a[i], a[i + 1]);
      if (x) a.push_back(x);
    }
    sort(a.begin(), a.end(), cmp_dfn);
    a.erase(unique(a.begin(), a.end()), a.end());
    Stack[top = 1] = 0;
    for (auto i : a) {
      while (!In(i, Stack[top])) top--;
      if (Stack[top]) tedge.emplace_back(i, Stack[top]);
      Stack[++top] = i;
    }
    A::solve(a, tedge);
    int chk = 0;
    for (auto i : v)
      if (!chk)
        chk = A::tmp[i];
      else if (chk != A::tmp[i])
        chk = -1;
    if (chk == -1)
      puts("NO");
    else
      puts("YES"), cnt_yes += Q, cnt_yes %= n;
  }
  return 0;
}
