#include <bits/stdc++.h>
using namespace std;
bool x[110][110];
int main() {
  int n;
  cin >> n;
  int a[100100][2], toth = 0, totaw = 0;
  map<int, int> home;
  map<int, int> away;
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    home[a[i][0]]++;
  }
  for (int i = 0; i < n; i++) {
    toth = (n - 1) + home[a[i][1]];
    totaw = (n - 1) - home[a[i][1]];
    cout << toth << " " << totaw << endl;
  }
  return 0;
}
