#include <bits/stdc++.h>
using namespace std;
int a[100000 + 100], b[100000 + 100], color[100000 + 100];
int main() {
  int n;
  cin >> n;
  int i;
  memset(color, 0, sizeof(color));
  for (i = 0; i < n; i++) {
    scanf("%d %d", &a[i], &b[i]);
    color[a[i]]++;
  }
  int sum = 0;
  for (i = 0; i <= 100000 + 100 - 95; i++) {
    sum += color[i];
  }
  for (i = 0; i < n; i++) {
    int l, r;
    r = sum - color[b[i]] - 1;
    l = 2 * (n - 1) - r;
    printf("%d %d\n", l, r);
  }
  return 0;
}
