#include <bits/stdc++.h>
using namespace std;
long long n, x[100010], y[100010], usx[100010];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
    usx[x[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << (n - 1) + usx[y[i]] << " " << n - (usx[y[i]]) - 1 << '\n';
  }
  return 0;
}
