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