#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t1, i, j, k;
  long long n, a, h;
  cin >> n;
  long long hm[n + 1], aw[n + 1], home[100005] = {0};
  for (i = 0; i < n; i++) {
    cin >> hm[i] >> aw[i];
    home[hm[i]]++;
  }
  for (i = 0; i < n; i++) {
    h = n - 1;
    a = n - 1;
    h += home[aw[i]];
    a -= home[aw[i]];
    cout << h << " " << a << "\n";
  }
}
