#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int home[n], away[n];
  for (int i = 0; i < n; i++) cin >> home[i] >> away[i];
  int count[1000000];
  memset(count, 0, sizeof count);
  for (int i = 0; i < n; i++) count[home[i]]++;
  for (int i = 0; i < n; i++)
    cout << n - 1 + count[away[i]] << " " << n - 1 - count[away[i]] << endl;
}
