#include <bits/stdc++.h>
using namespace std;
pair<int, int> pr[100001];
int main() {
  int n;
  map<int, int> mp, mp1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    mp[x]++;
    mp1[y]++;
    pr[i].first = x;
    pr[i].second = y;
  }
  for (int i = 0; i < n; i++) {
    int sum = n - 1, sum1 = 0;
    sum += mp[pr[i].second];
    sum1 = n - 1 - mp[pr[i].second];
    cout << sum << " " << sum1 << endl;
  }
  return 0;
}
