#include <bits/stdc++.h>
using namespace std;
long long x[100100], y[100100], check[100100];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (long long i = 1; i < 100100; i++) check[i] = 0;
  for (long long i = 1; i < n + 1; i++) {
    cin >> x[i] >> y[i];
    check[x[i]]++;
  }
  for (long long i = 1; i < n + 1; i++) {
    cout << n - 1 + check[y[i]] << " " << n - check[y[i]] - 1 << endl;
  }
  return 0;
}
