#include <bits/stdc++.h>
using namespace std;
int cnt[100000];
vector<pair<int, int> > V;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    V.push_back(make_pair(x, y));
    cnt[x - 1]++;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans = ans + cnt[V[i].second - 1] + n - 1;
    cout << ans << ' ' << 2 * (n - 1) - ans << endl;
    ans = 0;
  }
  return 0;
}
