#include <bits/stdc++.h>
using namespace std;
void fast_io() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int32_t main() {
  fast_io();
  long long n;
  cin >> n;
  long long x[n], y[n];
  map<long long, long long> m1, m2;
  for (long long i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    m1[x[i]]++;
    m2[y[i]]++;
  }
  long long temp = n * (n - 1);
  for (long long i = 0; i < n; i++) {
    cout << n - 1 + m1[y[i]] << " " << (n - 1) - (m1[y[i]]) << endl;
  }
  return 0;
}
