#include <bits/stdc++.h>
using namespace std;
int n, x[100005], y[100005], home[100005], away[100005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> x[i] >> y[i];
    home[x[i]]++;
    away[y[i]]++;
  }
  for (int i = 1; i <= n; ++i) {
    cout << n - 1 + home[y[i]] << ' ';
    cout << n - 1 - home[y[i]] << '\n';
  }
}
