#include #include #include #include using namespace std; #define int long long #define fi first #define se second #define pb push_back #define sz(a) (int)a.size() #define all(a) begin(a),end(a) using ll = long long; using vi = vector; using ar2 = array; using ar4 = array; const int mxN = (int)2e5+2; const int INF = (int)1e9; const ll LINF = (ll)2e18; const int MOD = (1ll<<61)-1; int n, m, q, dfs_tim; int st[mxN], low[mxN], vis[mxN]; vi adj[mxN]; struct DSU{ int p[mxN], sz[mxN]; void init(int n){ for(int i = 1; i <= n; i++) p[i]=i, sz[i]=1; } int findSet(int i){ return i==p[i]?i:p[i]=findSet(p[i]); } bool isSameSet(int i, int j){return findSet(i)==findSet(j); } void unionSet(int i, int j){ int x = findSet(i), y = findSet(j); if(x==y) return; if(sz[x]st[s]) dsu.unionSet(s,u); } else low[s]=min(low[s],st[u]); } vis[s] = 2; } void solve(){ cin >> n >> m >> q; dsu.init(n); for(int i = 1; i <= m; i++){ int a, b; cin >> a >> b; adj[a].pb(b); adj[b].pb(a); } for(int i = 1; i <= n; i++) if(!vis[i]) dfs(i,-1); for(int i = 1; i <= q; i++){ int x, y; cin >> x >> y; cout << (dsu.isSameSet(x,y)?"Yes":"No") << "\n"; } } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); int t = 1; //cin >> t; while(t--) solve(); }