#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> x(n);
  int array1[n][2];
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    cin >> x[i];
    array1[i][0] = n - 1;
    array1[i][1] = n - 1;
  }
  int a = 1;
  sort(v.begin(), v.end());
  vector<int>::iterator it1, it2;
  for (int i = 0; i < n; i++) {
    it1 = lower_bound(v.begin(), v.end(), x[i]);
    it2 = upper_bound(v.begin(), v.end(), x[i]);
    array1[i][1] = array1[i][1] - (it2 - it1);
    array1[i][0] = array1[i][0] + (it2 - it1);
  }
  for (int i = 0; i < n; i++) {
    cout << array1[i][0] << " " << array1[i][1] << endl;
  }
}
