#include <bits/stdc++.h>
using namespace std;
long long homeu[100005] = {0};
void solve() {
  long long n = 0;
  cin >> n;
  long long b[n][2];
  for (int i = 0; i < n; i++) {
    cin >> b[i][0] >> b[i][1];
    homeu[b[i][0]]++;
  }
  for (int i = 0; i < n; i++) {
    long long home_dress = (n - 1) + homeu[b[i][1]];
    long long away_dress = 2 * (n - 1) - home_dress;
    cout << home_dress << " " << away_dress << "\n";
  }
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
