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