#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j;
  cin >> n;
  long long int h[n], a[n], ans1[n], ans2[n], count[100001];
  for (i = 0; i <= 100000; i++) count[i] = 0;
  for (i = 0; i < n; i++) {
    cin >> h[i] >> a[i];
    count[h[i]] += 1;
  }
  for (i = 0; i < n; i++) ans1[i] = n - 1;
  for (i = 0; i < n; i++) {
    ans1[i] += count[a[i]];
  }
  for (i = 0; i < n; i++) ans2[i] = ((n - 1) * 2) - ans1[i];
  for (i = 0; i < n; i++) cout << ans1[i] << " " << ans2[i] << "\n";
  return 0;
}
