#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int h[n + 1];
  long long int a[n + 1];
  long long int home[n + 1];
  long long int size = pow(10, 5) + 2;
  long long int home_counts[size];
  for (long long int i = 1; i <= size; i++) home_counts[i] = 0;
  long long int away[n + 1];
  for (long long int i = 1; i <= n; i++) {
    cin >> h[i] >> a[i];
    home[i] = n - 1;
    away[i] = n - 1;
    home_counts[h[i]]++;
  }
  for (long long int i = 1; i <= n; i++) {
    away[i] = n - 1 - home_counts[a[i]];
    home[i] = n - 1 + home_counts[a[i]];
  }
  for (long long int i = 1; i <= n; i++)
    cout << home[i] << " " << away[i] << endl;
}
