#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> vp;
  map<int, int> mp;
  vector<pair<int, int>> ans;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    vp.push_back({x, y});
    ans.push_back({0, 0});
    mp[x]++;
  }
  for (int i = 0; i < n; i++) {
    ans[i].first += n - 1;
    ans[i].first += mp[vp[i].second];
    ans[i].second += 2 * (n - 1) - ans[i].first;
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
  return 0;
}
