#include <bits/stdc++.h>
using namespace std;
int a[100000], b[100000], x[100000], y[100000], n;
int cx[100001], cy[100001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    a[i] = n - 1;
    b[i] = n - 1;
    cin >> x[i] >> y[i];
    cx[x[i]]++;
  }
  for (int i = 0; i < n; i++) {
    int t = cx[y[i]];
    a[i] += t;
    b[i] -= t;
  }
  for (int i = 0; i < n; i++) cout << a[i] << " " << b[i] << endl;
  return 0;
}
