#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[100100] = {0}, b[100100] = {0}, c[100100] = {0};
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    c[a[i]]++;
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", n - 1 + c[b[i]]);
    printf("%d\n", n - 1 - c[b[i]]);
  }
  return 0;
}
