#include <bits/stdc++.h>
using namespace std;
const int MAX = 100001;
const long long mod = 1000 * 1000 * 1000 + 7;
int main() {
  int n;
  while (cin >> n) {
    vector<pair<int, int> > v;
    map<int, int> a, b;
    for (int i = 0; i < n; i++) {
      int c, d;
      cin >> c >> d;
      v.push_back(make_pair(c, d));
      a[c]++, b[d]++;
    }
    for (int i = 0; i < n; i++) {
      int c = v[i].first, d = v[i].second;
      int x = a[d];
      cout << n - 1 + x << " " << n - 1 - x << endl;
    }
  }
  return 0;
}
