#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int x[100005];
  int y[100005];
  int z[100005];
  int NumOfTeams;
  int home_Play, away_Play;
  for (int i = 0; i < 100005; i++) z[i] = 0;
  while (cin >> NumOfTeams) {
    for (int i = 0; i < NumOfTeams; i++) {
      cin >> x[i] >> y[i];
      z[x[i]]++;
    }
    for (int i = 0; i < NumOfTeams; i++) {
      home_Play = NumOfTeams - 1 + z[y[i]];
      away_Play = NumOfTeams - 1 - z[y[i]];
      cout << home_Play << "  " << away_Play << endl;
    }
  }
  return 0;
}
