#include using namespace std; using ll = long long; #define rep(i, s, t) for (int i = (int)(s); i < (int)(t); ++i) #define revrep(i, t, s) for (int i = (int)(t)-1; i >= (int)(s); --i) #define all(x) begin(x), end(x) template bool chmax(T& a, const T& b) { return a < b ? (a = b, 1) : 0; } template bool chmin(T& a, const T& b) { return a > b ? (a = b, 1) : 0; } class Lowlink { public: Lowlink() = default; explicit Lowlink(const std::vector>& G) : G(G), ord(G.size(), -1), low(G.size()) { for (int i = 0; i < (int) G.size(); ++i) { if (ord[i] == -1) dfs(i, -1); } } std::vector> get_bridges() const { return bridge; } std::vector get_articulation_points() const { return articulation; } bool is_bridge(int u, int v) const { if (ord[u] > ord[v]) std::swap(u, v); return ord[u] < low[v]; } protected: std::vector> G; std::vector ord, low; std::vector> bridge; std::vector articulation; private: int k = 0; void dfs(int v, int p) { ord[v] = k++; low[v] = ord[v]; bool is_articulation = false, checked = false; int cnt = 0; for (int c : G[v]) { if (c == p && !checked) { checked = true; continue; } if (ord[c] == -1) { ++cnt; dfs(c, v); low[v] = std::min(low[v], low[c]); if (p != -1 && ord[v] <= low[c]) is_articulation = true; if (ord[v] < low[c]) bridge.push_back(std::minmax(v, c)); } else { low[v] = std::min(low[v], ord[c]); } } if (p == -1 && cnt > 1) is_articulation = true; if (is_articulation) articulation.push_back(v); } }; class UnionFind { public: UnionFind() = default; explicit UnionFind(int n) : data(n, -1) {} int find(int x) { if (data[x] < 0) return x; return data[x] = find(data[x]); } void unite(int x, int y) { x = find(x); y = find(y); if (x == y) return; if (data[x] > data[y]) std::swap(x, y); data[x] += data[y]; data[y] = x; } bool same(int x, int y) { return find(x) == find(y); } int size(int x) { return -data[find(x)]; } private: std::vector data; }; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); int N, M, Q; cin >> N >> M >> Q; vector> G(N); rep(_,0,M) { int u, v; cin >> u >> v; --u, --v; G[u].push_back(v); G[v].push_back(u); } Lowlink low(G); UnionFind uf(N); rep(i,0,N) for (int j : G[i]) if (low.is_bridge(i, j)) uf.unite(i, j); while (Q--) { int x, y; cin >> x >> y; --x, --y; cout << (uf.same(x, y) ? "Yes" : "No") << "\n"; } }