#include #define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++) #define reb(i,s,n) for (int i = (int)(n)-1; i >= (int)(s); i--) #define all(v) begin(v), end(v) using namespace std; using ll = long long; bool chmin(auto &a, auto b) { return a > b ? a = b, 1 : 0; } bool chmax(auto &a, auto b) { return a < b ? a = b, 1 : 0; } const vector dx = {1,0,-1,0}; const vector dy = {0,1,0,-1}; template ostream &operator<<(ostream &os, const vector &a){ if (a.empty()) return os; os << a.front(); for (auto e : a | views::drop(1)){ os << ' ' << e; } return os; } void dump(auto ...vs){ ((cout << vs << ' '), ...) << endl; } #include using pii = pair; pii op(pii a, pii b){ return min(a,b); } pii e(){ return {1e9,1e9}; } pii mapping(int f, pii x){ x.first += f; return x; } int composition(int f, int g){ return f + g; } int ident(){ return 0; } void solve(){ int n, h, w; cin >> n >> h >> w; vector> recs(n); rep(i,0,n){ int lx, rx, ly, ry; cin >> lx >> rx >> ly >> ry; rx++, ry++; //int lx, rx, ly, ry; cin >> lx >> ly >> rx >> ry; rx++, ry++; recs[i] = {lx,rx,ly,ry}; } using dty = atcoder::lazy_segtree; vector ds(h+2); { vector imos(h+3,vector(w+3)); for (auto [lx, rx, ly, ry] : recs){ imos[lx][ly]++; imos[lx][ry]--; imos[rx][ly]--; imos[rx][ry]++; } rep(i,0,h+2) rep(j,0,w+3){ imos[i+1][j] += imos[i][j]; } rep(i,0,h+3) rep(j,0,w+2){ imos[i][j+1] += imos[i][j]; } rep(i,0,h+2){ ds[i] = dty([&]{ vector a(w+2); rep(j,0,w+2){ a[j] = {imos[i][j],j}; } return a; }()); } } int wcnt = 0; vector white(h+2,vector(w+2,false)); vector done(h+2,vector(w+2,false)); queue> que; auto add_white = [&](){ rep(x,0,h+2){ while (ds[x].all_prod().first == 0){ int y = ds[x].all_prod().second; white[x][y] = true; wcnt++; ds[x].set(y,e()); bool ok = false; rep(k,0,4){ int nx = x + dx[k]; int ny = y + dy[k]; if (0 <= nx && nx < h+2 && 0 <= ny && ny < w+2){ if (done[nx][ny]){ ok = true; } } } if (ok){ done[x][y] = true; que.emplace(x,y); } } } }; add_white(); assert(white[h+1][w+1]); que.emplace(h+1,w+1); done[h+1][w+1] = true; int vis = 0; vector ans(n); reb(i,0,n){ while (!que.empty()){ auto [x, y] = que.front(); que.pop(); vis++; rep(k,0,4){ int nx = x + dx[k]; int ny = y + dy[k]; if (0 <= nx && nx < h+2 && 0 <= ny && ny < w+2){ if (!done[nx][ny] && white[nx][ny]){ done[nx][ny] = true; que.emplace(nx,ny); } } } } assert(wcnt >= vis); ans[i] = (wcnt != vis); auto [lx, rx, ly, ry] = recs[i]; rep(x,lx,rx){ ds[x].apply(ly,ry,-1); } add_white(); } rep(i,0,n){ cout << (ans[i] ? "Yes" : "No") << '\n'; } } int main(){ cin.tie(0)->sync_with_stdio(0); solve(); }