#include namespace { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic pop using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; dsu d; std::pair, std::vector> lowlink(std::vector>& to) { // returns a pair of (ord, low) std::pair, std::vector> res; const int n = to.size(); auto& ord = res.first; auto& low = res.second; ord.resize(n, -1); low.resize(n); int nxt_ord = 0; auto dfs = [&](auto&& self, int u, int parent=-1) -> void { low[u] = ord[u] = nxt_ord++; for(int v: to[u]) { if (v == parent) continue; if (ord[v] == -1) { self(self, v, u); if (low[v] < low[u]) low[u] = low[v]; } else { if (ord[v] < low[u]) low[u] = ord[v]; } } if (parent != -1 && ord[u] == low[u]) { d.merge(u, parent); } }; for(int i = 0; i < n; i++) if (ord[i] == -1) dfs(dfs, i); return res; } } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, q; cin >> n >> m >> q; VVI to(n); rep(_, m) { int u, v; cin >> u >> v; u--, v--; to[u].emplace_back(v); to[v].emplace_back(u); } d = dsu(n); lowlink(to); rep(_, q) { int x, y; cin >> x >> y; cout << (d.same(x - 1, y - 1) ? "Yes\n" : "No\n"); } }