#include <bits/stdc++.h>
using namespace std;
int n, x, y;
const int maxn = 1e5 + 20;
int a[maxn], b[maxn], cnt[maxn];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    cnt[a[i]]++;
  }
  for (int i = 0; i < n; i++) {
    cout << n - 1 + cnt[b[i]] << " " << n - 1 - cnt[b[i]] << endl;
  }
  return 0;
}
