#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long i, n, x[100009], y[100009], count[100009] = {0}, home[100009],
                                        away[100009];
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> x[i] >> y[i];
    ++count[x[i]];
  }
  for (i = 1; i <= n; ++i) {
    home[i] = n - 1;
    home[i] += count[y[i]];
    away[i] = 2 * (n - 1) - home[i];
  }
  for (i = 1; i <= n; ++i) cout << home[i] << " " << away[i] << "\n";
  return 0;
}
