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