#include <bits/stdc++.h>
using namespace std;
long long n, sum, num, sam, nam;
pair<long long, long long> w[100001];
long long q[100001], e[100001];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> w[i].first >> w[i].second;
    q[w[i].first]++;
    e[w[i].second]++;
  }
  for (int i = 1; i <= n; i++) {
    cout << n - 1 + q[w[i].second] << " ";
    cout << (n - 1) * 2 - (n - 1 + q[w[i].second]) << endl;
  }
}
