#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n = 0;
  cin >> n;
  vector<vector<int> > vt(100005, vector<int>(2, 0));
  unordered_map<int, int> mp;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= 1; j++) {
      cin >> vt[i][j];
      if (j == 0) {
        mp[vt[i][j]]++;
      }
    }
  }
  int k = n - 1, h = 0, aw = 0;
  for (int i = 0; i < n; i++) {
    aw = n - 1 - mp[vt[i][1]];
    h = (n - 1) * 2 - aw;
    cout << h << " " << aw << "\n";
  }
  return 0;
}
