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