#include <bits/stdc++.h>
using namespace std;
std::pair<int, int> gm[100000 + 1];
int game[100000 + 1];
int main() {
  std::ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = (1); i <= (n); ++i) {
    int h, a;
    cin >> h >> a;
    gm[i].first = h;
    gm[i].second = a;
    game[h]--;
  }
  for (int i = (1); i <= (n); ++i) {
    cout << (n - 1) - game[gm[i].second] << " " << (n - 1) + game[gm[i].second]
         << "\n";
  }
}
