#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5;
long long sum[N * 20], ans;
int tot, cnt[N * 20], ls[N * 20], rs[N * 20];
int root[N], f[N];
int n, a, b;
int find(int x) {
  if (x == f[x]) return x;
  return f[x] = find(f[x]);
}
int Ins(int k, int l, int r, int p, int a1, int a2) {
  int tmp = ++tot;
  if (l == r) {
    sum[tmp] = n - p + 1;
    cnt[tmp] = 1;
    ans += (long long)(a1 - a2) * (n - p + 1);
    return tmp;
  }
  int mid = l + r >> 1;
  if (p <= mid) {
    rs[tmp] = rs[k];
    ls[tmp] = Ins(ls[k], l, mid, p, a1, a2);
    ans += sum[rs[tmp]];
  } else {
    ls[tmp] = ls[k];
    rs[tmp] = Ins(rs[k], mid + 1, r, p, a1 + cnt[ls[tmp]], a2);
  }
  sum[tmp] = sum[ls[tmp]] + sum[rs[tmp]];
  cnt[tmp] = cnt[ls[tmp]] + cnt[rs[tmp]];
  return tmp;
}
int merge(int a, int b) {
  if (!a || !b) return a + b;
  ans += sum[rs[a]] * cnt[ls[b]];
  ans -= sum[ls[b]] * cnt[rs[a]];
  int tmp = ++tot;
  ls[tmp] = merge(ls[a], ls[b]);
  rs[tmp] = merge(rs[a], rs[b]);
  sum[tmp] = sum[ls[tmp]] + sum[rs[tmp]];
  cnt[tmp] = cnt[ls[tmp]] + cnt[rs[tmp]];
  return tmp;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    int fa = find(a);
    if (fa) {
      root[fa] = Ins(root[fa], 1, n, n - b + 1, fa, a);
      f[fa + cnt[root[fa]] - 1] = fa;
    } else {
      root[a] = Ins(root[a], 1, n, n - b + 1, a, a);
      f[a] = a;
      if (f[a - 1]) {
        f[a] = f[a - 1];
        root[find(a)] = merge(root[find(a)], root[a]);
      }
    }
    fa = find(a);
    if (f[fa + cnt[root[fa]]]) {
      f[fa + cnt[root[fa]]] = fa;
      root[fa] = merge(root[fa], root[fa + cnt[root[fa]]]);
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
