#include <bits/stdc++.h>
using namespace std;
int n, sum, x, a[110000];
int main() {
  ios_base::sync_with_stdio(false);
  long n, k;
  cin >> n;
  long a[100005] = {0}, b[100005] = {0}, x[100005] = {0}, y[100005] = {0};
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    a[x[i]]++;
  }
  long p, ans = 0;
  for (int i = 0; i < n; i++) {
    p = y[i];
    ans = n - 1 + a[p];
    cout << ans << " " << 2 * (n - 1) - ans << endl;
  }
  return 0;
}
