#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long i;
  long long home[n];
  long long away[n];
  long long array[1000000] = {0};
  for (i = 0; i < n; i++) {
    cin >> home[i] >> away[i];
    array[home[i] - 1] += 1;
  }
  long long home_kit[n];
  long long away_kit[n];
  for (i = 0; i < n; i++) home_kit[i] = (n - 1);
  for (i = 0; i < n; i++) {
    home_kit[i] += array[away[i] - 1];
    away_kit[i] = (2 * (n - 1)) - home_kit[i];
  }
  for (i = 0; i < n; i++) cout << home_kit[i] << " " << away_kit[i] << endl;
}
