#include <bits/stdc++.h>
int a[111111], x[111111], y[111111], i, n;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d%d", x + i, y + i), a[x[i]]++;
  for (i = 1; i <= n; i++) printf("%d %d\n", n - 1 + a[y[i]], n - 1 - a[y[i]]);
}
