#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int home[100005], away[100005];
  int homeCount[100005], awayCount[100005];
  memset(homeCount, 0, sizeof homeCount);
  memset(awayCount, 0, sizeof awayCount);
  cin >> n;
  map<int, int> mapCount;
  for (int i = 0; i < n; i++) {
    cin >> home[i] >> away[i];
    mapCount[home[i]]++;
    homeCount[i] += n - 1;
  }
  for (int i = 0; i < n; i++) {
    if (mapCount.find(away[i]) != mapCount.end()) {
      homeCount[i] += mapCount[away[i]];
      awayCount[i] += (n - 1 - mapCount[away[i]]);
      continue;
    }
    awayCount[i] += (n - 1);
  }
  for (int i = 0; i < n; i++) {
    cout << homeCount[i] << " " << awayCount[i] << endl;
  }
}
