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