#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, h, a;
  vector<int> home, away;
  cin >> n;
  vector<int> cnt(100000, 0);
  vector<int> ans_home(n, 0);
  vector<int> ans_away(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> h >> a;
    home.push_back(h);
    away.push_back(a);
  }
  for (int i = 0; i < n; i++) cnt[home[i] - 1]++;
  for (int i = 0; i < n; i++) {
    ans_home[i] = n - 1 + cnt[away[i] - 1];
    ans_away[i] = 2 * (n - 1) - ans_home[i];
  }
  for (int i = 0; i < n; i++) cout << ans_home[i] << " " << ans_away[i] << endl;
  return 0;
}
