#include <bits/stdc++.h>
using namespace std;
int main() {
  int *b = new int[100001](), n, t;
  cin >> n;
  int *a = new int[n];
  for (int i = 0; i < n; ++i) {
    cin >> t >> a[i];
    b[t]++;
  }
  for (int i = 0; i < n; ++i) {
    cout << b[a[i]] + n - 1 << " " << n - b[a[i]] - 1 << endl;
  }
  delete[] a;
  delete[] b;
  return 0;
}
