#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int q;
cin >> q;
vector<int> x;
vector<pair<int, int>> queries(q);
for(int i = 0; i < q; i++)
{
int l, r;
cin >> l >> r;
r++;
queries[i] = make_pair(l, r);
x.push_back(l);
x.push_back(r);
}
sort(x.begin(), x.end());
x.resize(unique(x.begin(), x.end()) - x.begin());
for(int i = 0; i < q; i++)
{
queries[i].first = lower_bound(x.begin(), x.end(), queries[i].first) - x.begin();
queries[i].second = lower_bound(x.begin(), x.end(), queries[i].second) - x.begin();
}
set<int> notInS;
for(int i = 0; i <= x.size(); i++)
notInS.insert(i);
int ans = 0;
for(int i = 0; i < q; i++)
{
int l = queries[i].first, r = queries[i].second;
while(true)
{
auto it = notInS.lower_bound(l);
if(it == notInS.end() || *it >= r)
break;
ans += x[*it + 1] - x[*it];
notInS.erase(it);
}
cout << ans << "\n";
}
return 0;
}