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