#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y;
  cin >> n;
  int team[n];
  map<int, int> h_color;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    team[i] = y;
    ++h_color[x];
  }
  int temp = 2 * (n - 1);
  for (int i = 0; i < n; ++i) {
    x = (n - 1) + h_color[team[i]];
    cout << x << ' ' << temp - x << '\n';
  }
  return 0;
}
