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