#include <bits/stdc++.h>
using namespace std;
int ar[100001];
int main() {
  int n, a, b;
  vector<int> v;
  cin >> n;
  for (int i = 0; i < (n); i++) {
    cin >> a >> b;
    ar[a]++;
    v.push_back(b);
  }
  int x;
  for (int i = 0; i < (n); i++) {
    x = ar[v[i]] + n - 1;
    cout << x << " " << (2 * (n - 1) - x) << endl;
  }
  return 0;
}
