#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, cnt = 0, ans = 0;
  cin >> n;
  vector<long long int> h(n);
  vector<long long int> a(n);
  vector<long long int> vec(100001, 0);
  for (long long int i = 0; i < n; i++) {
    cin >> h.at(i) >> a.at(i);
    (vec.at(h.at(i)))++;
  }
  for (long long int i = 0; i < n; i++) {
    cout << (n - 1) + (vec.at(a.at(i))) << " "
         << (2 * (n - 1)) - (n - 1 + (vec.at(a.at(i)))) << endl;
    ;
  }
}
