#include using namespace std; using ll=long long; void solve(){ ll N,M; cin>>N>>M; ll SB=0; ll L=-1e18,R=1e18; for(int i=0;i>A>>B; R=min(R,A-SB); L=max(L,A-(SB+B-1)); // cout<>T; while(T--)solve(); }