#include <bits/stdc++.h>
using namespace std;
int home[int(1e5) + 10], away[int(1e5) + 10];
pair<int, int> teams[int(1e5) + 10];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    home[a]++;
    away[b]++;
    teams[i] = make_pair(a, b);
  }
  if (n == 1 || n == 0) {
    cout << 0 << " " << 0 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    cout << n - 1 + home[teams[i].second] << " "
         << n - home[teams[i].second] - 1 << endl;
  }
  return 0;
}
