#include <bits/stdc++.h>
using namespace std;
long long int home[100001] = {0};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, a, b, ho = 0, aw = 0;
  cin >> n;
  vector<long long> away;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    away.push_back(b);
    home[a]++;
  }
  for (int i = 0; i < away.size(); i++) {
    aw++;
    ho = (n - 1) + home[away[i]];
    cout << ho << " " << (n - 1) * 2 - ho;
    if (aw < n) cout << "\n";
  }
  return 0;
}
