#include <bits/stdc++.h>
using namespace std;
long int cnt[100005];
int main() {
  ios_base::sync_with_stdio(false);
  long int n, x, y, val;
  cin >> n;
  pair<long int, long int> p[n];
  pair<long int, long int> ans[n];
  for (long int i = 0; i < n; i++) {
    cin >> x >> y;
    cnt[x]++;
    p[i].first = x;
    p[i].second = y;
    ans[i].first = ans[i].second = n - 1;
  }
  for (long int i = 0; i < n; i++) {
    val = cnt[p[i].second];
    if (p[i].first == p[i].second) {
      val--;
    }
    ans[i].first += val;
    ans[i].second -= val;
  }
  for (long int i = 0; i < n; i++) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
  return 0;
}
