#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 100;
const long long lINF = 1e18;
const long double EPS = 1e-12;
const long double PI = acos(-1.0L);
int myrand() { return rand(); }
unsigned rdtsc() {
  unsigned ans;
  asm("rdtsc" : "=a"(ans));
  return ans;
}
int rnd(int x) { return myrand() % x; }
struct Graph {
  int n;
  vector<vector<int> > es;
  vector<vector<int> > eid;
  int cnte;
  Graph(int _n = 0) {
    n = _n;
    cnte = 0;
    es = eid = vector<vector<int> >(n);
  }
  void adde(int a, int b) {
    es[a].push_back(b);
    es[b].push_back(a);
    eid[a].push_back(cnte);
    eid[b].push_back(cnte);
    cnte++;
  }
  vector<int> used, tin, dp;
  vector<int> col;
  int cntcols, curt;
  vector<int> st;
  void dfs(int v, int pid = -1) {
    dp[v] = tin[v] = curt++;
    used[v] = 1;
    st.push_back(v);
    for (int i = 0; i < ((int)((es[v]).size())); i++) {
      int to = es[v][i];
      if (eid[v][i] == pid) {
        continue;
      }
      if (used[to]) {
        dp[v] = min(dp[v], tin[to]);
      } else {
        dfs(to, eid[v][i]);
        dp[v] = min(dp[v], dp[to]);
        if (dp[to] > tin[v]) {
          while (true) {
            int cur = st.back();
            col[cur] = cntcols;
            st.pop_back();
            if (cur == to) {
              break;
            }
          }
          cntcols++;
        }
      }
    }
  }
  void getcols() {
    cntcols = curt = 0;
    col = used = tin = dp = vector<int>(n);
    for (int i = 0; i < n; i++) {
      if (!used[i]) {
        dfs(i);
        while (((int)((st).size()))) {
          col[st.back()] = cntcols;
          st.pop_back();
        }
        cntcols++;
      }
    }
  }
};
int n, m, q;
Graph g;
int z;
vector<vector<int> > tree;
vector<vector<int> > uptree;
vector<int> tin, tout, used;
int curt;
bool read() {
  if (scanf("%d%d%d", &n, &m, &q) < 3) {
    return false;
  }
  g = Graph(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--, v--;
    g.adde(u, v);
  }
  return true;
}
void dfs(int v, int par = -1) {
  tin[v] = curt++;
  uptree[0][v] = (par == -1) ? v : par;
  used[v] = 1;
  for (int i = 0; i < ((int)((tree[v]).size())); i++) {
    if (tree[v][i] != par) {
      dfs(tree[v][i], v);
    }
  }
  tout[v] = curt;
}
bool isanc(int a, int b) { return tin[a] <= tin[b] && tout[a] >= tout[b]; }
int getlca(int a, int b) {
  for (int i = 19; i >= 0; i--) {
    if (!isanc(uptree[i][a], b)) {
      a = uptree[i][a];
    }
  }
  if (!isanc(a, b)) {
    a = uptree[0][a];
  }
  return a;
}
vector<int> interesting;
int getid(int v) {
  return (int)(lower_bound(interesting.begin(), interesting.end(), v) -
               interesting.begin());
}
int R;
int rotate(int i) {
  i = (i + R) % n;
  if (i == 0) {
    i = n;
  }
  return i;
}
void solve() {
  g.getcols();
  z = g.cntcols;
  tree = vector<vector<int> >(z);
  uptree = vector<vector<int> >(20, vector<int>(z));
  tin = tout = used = vector<int>(z);
  curt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < ((int)((g.es[i]).size())); j++) {
      int u = i, v = g.es[i][j];
      if (g.col[u] != g.col[v] && u < v) {
        tree[g.col[u]].push_back(g.col[v]);
        tree[g.col[v]].push_back(g.col[u]);
      }
    }
  }
  for (int i = 0; i < z; i++) {
    if (!used[i]) {
      dfs(i);
    }
  }
  for (int i = 1; i < 20; i++) {
    for (int j = 0; j < z; j++) {
      uptree[i][j] = uptree[i - 1][uptree[i - 1][j]];
    }
  }
  R = 0;
  for (int tnum = 0; tnum < q; tnum++) {
    int ni, mi;
    scanf("%d%d", &ni, &mi);
    vector<int> curv(ni);
    vector<pair<int, int> > cure(mi);
    interesting.clear();
    for (int i = 0; i < ni; i++) {
      scanf("%d", &curv[i]);
      curv[i] = rotate(curv[i]);
      curv[i] = g.col[curv[i] - 1];
      interesting.push_back(curv[i]);
    }
    for (int i = 0; i < mi; i++) {
      scanf("%d%d", &cure[i].first, &cure[i].second);
      cure[i].first = rotate(cure[i].first);
      cure[i].second = rotate(cure[i].second);
      cure[i].first = g.col[cure[i].first - 1];
      cure[i].second = g.col[cure[i].second - 1];
      interesting.push_back(cure[i].first);
      interesting.push_back(cure[i].second);
    }
    sort(interesting.begin(), interesting.end());
    interesting.resize(unique(interesting.begin(), interesting.end()) -
                       interesting.begin());
    vector<pair<int, int> > tosort;
    for (auto i : interesting) {
      tosort.push_back(make_pair(tin[i], i));
    }
    sort(tosort.begin(), tosort.end());
    for (int i = 0; i + 1 < ((int)((tosort).size())); i++) {
      int u = tosort[i].second, v = tosort[i + 1].second;
      if (uptree[19][u] != uptree[19][v]) {
        continue;
      }
      int lca = getlca(u, v);
      interesting.push_back(lca);
    }
    sort(interesting.begin(), interesting.end());
    interesting.resize(unique(interesting.begin(), interesting.end()) -
                       interesting.begin());
    Graph curg(((int)((interesting).size())));
    vector<int> st;
    tosort.clear();
    for (auto i : interesting) {
      tosort.push_back(make_pair(tin[i], i));
    }
    sort(tosort.begin(), tosort.end());
    for (auto i : tosort) {
      int u = i.second;
      while (((int)((st).size())) && tout[st.back()] <= tin[u]) {
        st.pop_back();
      }
      if (((int)((st).size()))) {
        curg.adde(getid(u), getid(st.back()));
      }
      st.push_back(u);
    }
    for (int i = 0; i < mi; i++) {
      curg.adde(getid(cure[i].first), getid(cure[i].second));
    }
    curg.getcols();
    bool yes = true;
    for (int i = 0; i + 1 < ((int)((curv).size())); i++) {
      int u = curv[i], v = curv[i + 1];
      if (curg.col[getid(u)] != curg.col[getid(v)]) {
        yes = false;
        break;
      }
    }
    R += (yes ? tnum + 1 : 0);
    R %= n;
    printf(yes ? "YES\n" : "NO\n");
  }
}
int main() {
  srand(rdtsc());
  while (true) {
    if (!read()) {
      break;
    }
    solve();
  }
  return 0;
}
