#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define overload4(_1, _2, _3, _4, name, ...) name #define rep0(a) for (ll _ = 0; _ < ll(a); ++_) #define rep1(i, n) for (ll i = 0; i < ll(n); ++i) #define rep2(i, s, n) for (ll i = ll(s); i < ll(n); ++i) #define rep3(i, s, n, d) for(ll i = ll(s); i < ll(n); i+=d) #define rep(...) overload4(__VA_ARGS__,rep3,rep2,rep1,rep0)(__VA_ARGS__) #define rrep0(a) for (ll _ = (a)-1; _ >= ll(0); -- _) #define rrep1(i, n) for (ll i = ll(n)-1; i >= 0; i--) #define rrep2(i, n, t) for (ll i = ll(n)-1; i >= (ll)t; i--) #define rrep3(i, n, t, d) for (ll i = ll(n)-1; i >= (ll)t; i-=d) #define drep(...) overload4(__VA_ARGS__,rrep3,rrep2,rrep1,rrep0)(__VA_ARGS__) typedef long long ll; typedef unsigned long long ull; typedef long double LD; typedef double D; typedef pair P; typedef map M; // /* #include using namespace atcoder; //using namespace internal; using mint =modint998244353; //using mint =modint1000000007; //using mint=static_modint<4649>; #define ip(x) atcoder::internal::is_prime_constexpr(x) istream &operator>>(istream &is, mint &a) { int v; cin >> v; a = v; return is; } ostream &operator<<(ostream &os, const mint &a) { return os << a.val(); } auto v_pow(ll n,ll base){vector v(n,1);rep(i,n-1){v[i+1]*=base*v[i];}return v;} // */ template istream &operator>>(istream &is, vector &v) { for (auto &e : v) is >> e; return is; } template ostream &operator<<(ostream &os, const vector &v) { for (auto &e : v) os << e << ' '; return os; } template istream &operator>>(istream &is, pair &p) { return is >> p.first >> p.second; } template ostream &operator<<(ostream &os, const pair &p) { return os << '{' << p.first << ", " << p.second << '}'; } template istream &operator>>(istream &is, tuple &t) { return is >> get<0>(t) >> get<1>(t) >> get<2>(t); } template ostream &operator<<(ostream &os, const tuple &t) {return os << '{' << get<0>(t) << ", " << get<1>(t) << ", " << get<2>(t) << '}';} #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define Game(n) cout << ((n) ? "First" : "Second" ) << endl template ll binary_search(F check,ll ok,ll ng,bool border= true) { /*binary_search(bool_func,okな値,ngな値)*///しっかり区間内に... if(border) assert(check(ok)); while(abs(ok-ng)>1){ auto x=(ng+ok)/2; tie(ok,ng)=(check(x)?make_pair(x, ng):make_pair(ok, x)); } return ok; } template double binary_search_real(F check,double ok,double ng,ll iter = 150) { rep(iter) { double x=(ok+ng)/2; tie(ok,ng)=(check(x)?make_pair(x,ng):make_pair(ok,x)); } return (ok+ng)/2; } void tatananonano() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout<< fixed << setprecision(10); } #define LL(...) ll __VA_ARGS__; IN(__VA_ARGS__) #define ULL(...) ull __VA_ARGS__; IN(__VA_ARGS__) #define INT(...) int __VA_ARGS__; IN(__VA_ARGS__) #define STR(...) string __VA_ARGS__; IN(__VA_ARGS__) #define CHR(...) char __VA_ARGS__;IN(__VA_ARGS__) #define LDL(...) LD __VA_ARGS__;IN(__VA_ARGS__) #define DBL(...) double __VA_ARGS__;IN(__VA_ARGS__) #define vv(type, name, h, ...) \ vector> name(h, vector(__VA_ARGS__)) #define vvv(type, name, h, w, ...) \ vector>> name( \ h, vector>(w, vector(__VA_ARGS__))) #define vvvv(type, name, a, b, c, ...) \ vector>>> name( \ a, vector>>( \ b, vector>(c, vector(__VA_ARGS__)))) //#define MINT(...) mint __VA_ARGS__;IN(__VA_ARGS__) template void scan(T &a) { cin >> a; } void IN() {} template void IN(Head &head, Tail &...tail) {scan(head);IN(tail...);} #define overload2(_1, _2, _3,name, ...) name #define out1(x) cout<,greater

>//小さい順 #define PQS PQ> #define fi first #define se second #define bit(n,k) ((n>>k)&1LL) #define popcount(n) __builtin_popcountll(n) template inline bool chmax(T& a,T b){if(a < b){a=b;return 1;}return 0;} template inline bool chmin(T& a,T b){if(a > b){a=b;return 1;}return 0;} template bool in_rect(T i,T j,T h,T w) {return 0 <= i and i < h and 0 <= j and j < w;} template bool is_in(T x,T a,T b){return (a<=x and x vec; typedef vector vs; using mat = vector; // template using matrix = vector>; const ll mod = 998244353; //const ll mod = 1000000007; const auto INF = (1LL<<(60)); template T ceil(T x, U y) {return (x > 0 ? (x + y - 1) / y : x / y);} template T floor(T x, U y) {return (x > 0 ? x / y : (x - y + 1) / y);} D getTime() { struct timeval s; gettimeofday(&s, NULL); return s.tv_sec + s.tv_usec * 1e-6; } template< typename G =mat > struct LowLink { const G &g; vec used, ord, low; vec articulation; vector

bridge; LowLink(const G &g) : g(g) {} ll dfs(ll idx,ll k,ll par) { used[idx] = true; ord[idx] = k++; low[idx] = ord[idx]; bool is_articulation = false; ll cnt = 0; for(auto &to : g[idx]) { if(!used[to]) { ++cnt; k = dfs(to, k, idx); low[idx] = min(low[idx], low[to]); is_articulation |= ~par && low[to] >= ord[idx]; if(ord[idx] < low[to]) bridge.emplace_back(minmax(idx,to)); } else if(to != par) { low[idx] = min(low[idx], ord[to]); } } is_articulation |= par == -1 && cnt > 1; if(is_articulation) articulation.push_back(idx); return k; } virtual void build() { used.assign(g.size(), 0); ord.assign(g.size(), 0); low.assign(g.size(), 0); int k = 0; for(int i = 0; i < g.size(); i++) { if(!used[i]) k = dfs(i, k, -1); } } }; int main(){ tatananonano(); LL(n,m,q); mat g(n); rep(i,m){ LL(u,v); u--;v--; g[u].pb(v); g[v].pb(u); } LowLink low(g); low.build(); dsu d(n); for(auto p:low.bridge){ d.merge(p.fi,p.se); } rep(q){ LL(x,y); x--;y--; Yes(d.same(x,y)); } }