#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int i, j;
    int x[100005], y[100005], ans[100005] = {0};
    for (i = 0; i < n; i++) {
      cin >> x[i] >> y[i];
      ans[x[i]]++;
    }
    for (i = 0; i < n; i++)
      cout << ans[y[i]] + n - 1 << ' ' << n - 1 - ans[y[i]] << endl;
  }
  return 0;
}
