#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include using namespace std; using namespace atcoder; using ll=long long; using P=pair; void IO(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); } using S = long long; using F = long long; const S INF = 8e18; const F ID = 8e18; S op(S a, S b){ return std::max(a, b); } S e(){ return -INF; } S mapping(F f, S x){ return (f == ID ? x : f); } F composition(F f, F g){ return (f == ID ? g : f); } F id(){ return ID; } int main(){ IO(); ll n,a; cin>>n>>a; vector

info(n); for(ll i=0;i>info[i].first; info[i].second=i; } sort(info.begin(),info.end()); vector x(n); for(ll i=0;i seg(n); ll t; cin>>t; for(ll i=1;i<=t;i++){ ll l,r; cin>>l>>r; ll vl=lower_bound(x.begin(),x.end(),l)-x.begin(); ll vr=upper_bound(x.begin(),x.end(),r)-x.begin(); seg.apply(vl,vr,i); } vector ans(n); for(ll i=0;i