#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  cin >> n;
  long x[n], y[n];
  for (long i = 0; i < n; i++) {
    cin >> x[i];
    cin >> y[i];
  }
  long h[n], a[n], cnt[100000];
  ;
  for (long i = 0; i < n; i++) {
    h[i] = 0;
    a[i] = 0;
  }
  for (long i = 0; i < 100000; i++) {
    cnt[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    cnt[x[i] - 1]++;
  }
  for (long i = 0; i < n; i++) {
    h[i] = n - 1;
    h[i] += cnt[y[i] - 1];
    a[i] = 2 * (n - 1) - h[i];
  }
  for (long i = 0; i < n; i++) {
    cout << h[i] << " " << a[i] << endl;
  }
}
