#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n + 1];
  int b[n + 1];
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    mp[a[i]]++;
  }
  for (int i = 0; i < n; i++) {
    int hh = n - 1 + mp[b[i]];
    cout << hh << " " << n - 1 - mp[b[i]] << "\n";
  }
}
