#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005];
int h[100005];
int n;
int main(int argc, char const *argv[]) {
  cin >> n;
  int i, j, k;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    h[a[i]]++;
  }
  for (i = 0; i < n; i++) {
    j = n - 1 + h[b[i]];
    k = 2 * n - 2 - j;
    cout << j << " " << k << endl;
  }
  return 0;
}
