#include using namespace std; typedef long long int ll; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll d; cin >> d; ll res=0; int n; cin >> n; set> st; st.insert(make_pair(-2e18,-2e18)); st.insert(make_pair(2e18,2e18)); for(int i=0;i> x >> y; y++; auto it=st.lower_bound(make_pair(x,y)); it--; if(it->first <= x and x <= it->second){ x=min(x,it->first); y=max(y,it->second); st.erase(it); } it=st.lower_bound(make_pair(x,y)); while(1){ if(x <= it->first and it->first <= y){ y=max(y,it->second); it=st.erase(it); } else break; } st.insert(make_pair(x,y)); res=max(res,y-x); printf("%lld\n",res); } }