#include <bits/stdc++.h>
using namespace std;
long int arr[100001] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long int n, home, away;
  cin >> n;
  vector<long int> b;
  for (long int i = 0; i < n; ++i) {
    cin >> home >> away;
    arr[home]++;
    b.push_back(away);
  }
  for (long int i = 0; i < b.size(); ++i) {
    cout << (n + arr[b[i]] - 1) << " " << (n - 1 - arr[b[i]]) << endl;
  }
  return 0;
}
