#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main() {
  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    vector<pair<int, int> > A(n);
    int away[100001] = {0};
    for (int i = 0; i < n; i++) {
      cin >> A[i].first >> A[i].second;
      away[A[i].first]++;
    }
    for (int i = 0; i < n; i++) {
      int a_match = n - 1 - away[A[i].second];
      int h_match = n - 1 + n - 1 - a_match;
      cout << h_match << " " << a_match << "\n";
    }
  }
  return 0;
}
