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