#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
stack<int> st;
int n, m, q, order, cnt;
long long R;
vector<int> ds[N], adj[N];
int pre[N], pre2[N], suf[N], suf2[N], tp[N], slt[N], cha[N][21], ss[N], q1[N],
    q2[N], d[N], tp2[N];
int lt[33], cs;
inline bool cmp(int i, int j) { return pre[i] < pre[j]; }
void dfs(int u, int pa) {
  order++;
  pre[u] = suf[u] = order;
  st.push(u);
  tp[u] = -1;
  for (auto v : ds[u]) {
    if (v == pa) {
      pa = -1;
      continue;
    }
    if (tp[v] == 0) {
      dfs(v, u);
      suf[u] = min(suf[u], suf[v]);
    } else
      suf[u] = min(suf[u], pre[v]);
  }
  if (pre[u] == suf[u]) {
    cnt++;
    while (st.top() != u) {
      tp[st.top()] = cnt;
      st.pop();
    }
    tp[u] = cnt;
    st.pop();
  }
}
void dfs2(int u, int pa) {
  order++;
  pre2[u] = suf2[u] = order;
  st.push(u);
  slt[u] = -1;
  for (auto v : ds[u]) {
    if (v == pa) {
      pa = -1;
      continue;
    }
    if (slt[v] == 0) {
      dfs2(v, u);
      suf2[u] = min(suf2[u], suf2[v]);
    } else
      suf2[u] = min(suf2[u], pre2[v]);
  }
  if (pre2[u] == suf2[u]) {
    cnt++;
    while (st.top() != u) {
      slt[st.top()] = cnt;
      st.pop();
    }
    slt[u] = cnt;
    st.pop();
  }
}
void traverse(int u, int pa) {
  cha[u][0] = pa;
  order++;
  pre[u] = order;
  for (auto v : adj[u]) {
    if (v == pa) continue;
    if (d[v] == 0) {
      d[v] = d[u] + 1;
      tp2[v] = tp2[u];
      traverse(v, u);
    }
  }
  order++;
  suf[u] = order;
}
int bien(int a) {
  a = (a + R) % n;
  if (a == 0) return n;
  return a;
}
int lca(int u, int v) {
  if (d[u] > d[v]) swap(u, v);
  if (d[u] < d[v])
    for (int j = cs - 1; j >= 0; j--) {
      if (d[v] - lt[j] >= d[u]) v = cha[v][j];
    }
  if (u == v) return u;
  for (int j = cs - 1; j >= 0; j--) {
    if (cha[u][j] > 0 && cha[u][j] != cha[v][j]) {
      u = cha[u][j];
      v = cha[v][j];
    }
  }
  return cha[u][0];
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    ds[u].push_back(v);
    ds[v].push_back(u);
  }
  cnt = 0;
  for (int i = 1; i <= n; i++)
    if (tp[i] == 0) {
      order = 0;
      dfs(i, 0);
    }
  for (int i = 1; i <= n; i++)
    for (auto v : ds[i]) {
      if (tp[i] == tp[v]) continue;
      adj[tp[i]].push_back(tp[v]);
    }
  order = 0;
  for (int i = 1; i <= cnt; i++) {
    if (d[i] > 0) continue;
    d[i] = 1;
    tp2[i] = i;
    traverse(i, 0);
  }
  int maxd = 0;
  for (int i = 1; i <= cnt; i++) maxd = max(maxd, d[i]);
  cs = 1;
  lt[0] = 1;
  lt[1] = 2;
  while (lt[cs] < maxd) {
    cs++;
    lt[cs] = lt[cs - 1] << 1;
  }
  for (int j = 1; j < cs; j++)
    for (int i = 1; i <= n; i++)
      if (cha[i][j - 1] == 0)
        cha[i][j] = 0;
      else
        cha[i][j] = cha[cha[i][j - 1]][j - 1];
  for (int qq = 1; qq <= q; qq++) {
    int nn, mm;
    scanf("%d%d", &nn, &mm);
    vector<int> dinh;
    dinh.clear();
    for (int i = 0; i < nn; i++) {
      scanf("%d", ss + i);
      ss[i] = tp[bien(ss[i])];
      dinh.push_back(ss[i]);
    }
    for (int i = 0; i < mm; i++) {
      scanf("%d%d", q1 + i, q2 + i);
      q1[i] = tp[bien(q1[i])];
      q2[i] = tp[bien(q2[i])];
      dinh.push_back(q1[i]);
      dinh.push_back(q2[i]);
    }
    sort(dinh.begin(), dinh.end(), cmp);
    for (int i = dinh.size() - 1; i > 0; i--) {
      if (dinh[i] != dinh[i - 1] && tp2[dinh[i]] == tp2[dinh[i - 1]]) {
        dinh.push_back(lca(dinh[i], dinh[i - 1]));
      }
    }
    sort(dinh.begin(), dinh.end(), cmp);
    for (auto v : dinh) ds[v].clear();
    stack<int> tt;
    while (!tt.empty()) tt.pop();
    vector<int> dinh2;
    dinh2.clear();
    for (int i = 0; i < dinh.size(); i++) {
      if (i == 0 || dinh[i] != dinh[i - 1]) {
        dinh2.push_back(dinh[i]);
        slt[dinh[i]] = 0;
        while (tt.empty() == false && suf[tt.top()] <= suf[dinh[i]]) tt.pop();
        if (tt.empty() == false) {
          ds[tt.top()].push_back(dinh[i]);
          ds[dinh[i]].push_back(tt.top());
        }
        tt.push(dinh[i]);
      }
    }
    for (int i = 0; i < mm; i++) {
      if (q1[i] == q2[i]) continue;
      ds[q1[i]].push_back(q2[i]);
      ds[q2[i]].push_back(q1[i]);
    }
    order = 0;
    cnt = 0;
    for (int i = 0; i < dinh2.size(); i++)
      if (slt[dinh2[i]] == 0) {
        dfs2(dinh2[i], 0);
      }
    bool ok = true;
    for (int i = 1; i < nn; i++)
      if (slt[ss[i]] != slt[ss[i - 1]]) {
        ok = false;
        break;
      }
    if (ok) {
      printf("YES\n");
      R += qq;
    } else
      printf("NO\n");
  }
  return 0;
}
