#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> home(n, 0), away(n, 0);
  map<int, int> cnt;
  for (int i = 0; i < n; ++i) {
    cin >> home[i] >> away[i];
    if (cnt.find(home[i]) == cnt.end())
      cnt.insert(make_pair(home[i], 1));
    else
      cnt[home[i]]++;
  }
  for (int i = 0; i < n; ++i) {
    cout << n - 1 + cnt[away[i]] << " " << n - 1 - cnt[away[i]] << endl;
  }
}
