#include <bits/stdc++.h>
using namespace std;
template <typename tn>
void read(tn &a) {
  tn x = 0, f = 1;
  char c = ' ';
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  a = x * f;
}
const int N = 301000;
int n, m, Q;
struct Graph {
  vector<int> e[N], P;
  int h[N], dfn[N], low[N], tim, cnt, st[N], top;
  void add(int x, int y) { e[x].push_back(y); }
  void clear() {
    for (int x : P) e[x].clear(), dfn[x] = low[x] = 0, h[x] = 0;
    tim = 0;
    cnt = 0;
    P.clear();
  }
  void tarjan(int x, int dad) {
    dfn[x] = low[x] = ++tim;
    st[++top] = x;
    int flag = 0;
    for (int v : e[x])
      if (v != dad || flag)
        if (!dfn[v]) {
          tarjan(v, x);
          low[x] = min(low[x], low[v]);
        } else
          low[x] = min(low[x], dfn[v]);
      else
        flag = 1;
    if (dfn[x] == low[x]) {
      h[x] = ++cnt;
      for (; st[top] != x; top--) h[st[top]] = cnt;
      top--;
    }
  }
  void Tarjan() {
    for (int x : P)
      if (!dfn[x]) tarjan(x, 0);
  }
} G, g;
struct Tree {
  int dfn[N], s[N], fa[20][N], dep[N], tim, n, pos[N];
  vector<int> e[N];
  void add(int x, int y) { e[x].push_back(y); }
  void dfs(int x, int dad) {
    dfn[x] = ++tim;
    pos[tim] = x;
    s[x] = 1;
    fa[0][x] = dad;
    dep[x] = dep[dad] + 1;
    for (int v : e[x])
      if (v != dad) dfs(v, x), s[x] += s[v];
  }
  void build() {
    for (int i = 1; i <= n; i++)
      if (!dfn[i]) dfs(i, 0);
    for (int i = 1; i <= 18; i++)
      for (int j = 1; j <= n; j++) fa[i][j] = fa[i - 1][fa[i - 1][j]];
  }
  int lca(int x, int y) {
    if (dep[x] < dep[y]) swap(x, y);
    for (int k = dep[x] - dep[y], i = 0; k; k >>= 1, i++)
      if (k & 1) x = fa[i][x];
    if (x == y) return x;
    for (int i = 18; ~i; i--)
      if (fa[i][x] != fa[i][y]) x = fa[i][x], y = fa[i][y];
    return fa[0][x];
  }
  void solve(vector<int> P, Graph &g) {
    for (int &x : P) x = dfn[x];
    for (int i = P.size() - 1; i; i--) {
      P.push_back(dfn[lca(pos[P[i]], pos[P[i - 1]])]);
    }
    sort(P.begin(), P.end());
    P.resize(unique(P.begin(), P.end()) - P.begin());
    if (P.size() && P[0] == 0) P.erase(P.begin());
    stack<int> st;
    for (int k : P) {
      int x = pos[k];
      while (!st.empty() &&
             (dfn[st.top()] > dfn[x] || dfn[st.top()] + s[st.top()] <= dfn[x]))
        st.pop();
      if (!st.empty()) g.add(x, st.top()), g.add(st.top(), x);
      st.push(x);
    }
    for (int &x : P) x = pos[x];
    g.P = P;
  }
} T;
int main() {
  read(n);
  read(m);
  read(Q);
  for (int i = 1; i <= m; i++) {
    int x, y;
    read(x);
    read(y);
    G.add(x, y);
    G.add(y, x);
  }
  for (int i = 1; i <= n; i++) G.P.push_back(i);
  G.Tarjan();
  for (int i = 1; i <= n; i++)
    for (int v : G.e[i])
      if (G.h[i] != G.h[v]) T.add(G.h[i], G.h[v]);
  T.n = G.cnt;
  T.build();
  int R = 0, TT = 0;
  while (Q--) {
    TT++;
    int k1, k2;
    read(k1);
    read(k2);
    vector<int> v, q;
    for (int i = 1; i <= k1; i++) {
      int x;
      read(x);
      x = (x + R) % n;
      if (!x) x = n;
      v.push_back(G.h[x]);
      q.push_back(G.h[x]);
    }
    for (int i = 1; i <= k2; i++) {
      int x, y;
      read(x);
      read(y);
      x = (x + R) % n;
      y = (y + R) % n;
      if (!x) x = n;
      if (!y) y = n;
      g.add(G.h[x], G.h[y]);
      g.add(G.h[y], G.h[x]);
      v.push_back(G.h[x]);
      v.push_back(G.h[y]);
    }
    sort(v.begin(), v.end());
    v.resize(unique(v.begin(), v.end()) - v.begin());
    sort(q.begin(), q.end());
    q.resize(unique(q.begin(), q.end()) - q.begin());
    T.solve(v, g);
    g.Tarjan();
    for (int &x : q) x = g.h[x];
    sort(q.begin(), q.end());
    q.resize(unique(q.begin(), q.end()) - q.begin());
    if (q.size() == 1)
      puts("YES"), R = (R + TT) % n;
    else
      puts("NO");
    g.clear();
  }
  return 0;
}
