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