#include <bits/stdc++.h>
using namespace std;
int arr[100001] = {0};
int main() {
  int n, tmp1, tmp2;
  cin >> n;
  int arr2[n];
  for (int i = 0; i < n; i++) {
    cin >> tmp1 >> tmp2;
    arr[tmp1]++;
    arr2[i] = tmp2;
  }
  for (int i = 0; i < n; i++) {
    int m = arr2[i];
    cout << n - 1 + arr[m] << " ";
    cout << n - 1 - arr[m] << endl;
  }
  return 0;
}
