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