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