#include <bits/stdc++.h>
using namespace std;
int main() {
  int home[100010] = {0}, away[100010] = {0};
  int color[100010][2] = {0};
  int hash[100010][2] = {0};
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> color[i][0] >> color[i][1];
    hash[color[i][0]][0]++;
    hash[color[i][1]][1]++;
  }
  int total = 2 * (n - 1);
  for (int i = 1; i <= n; i++) {
    home[i] = n - 1;
    int awayColor = color[i][1];
    home[i] += hash[awayColor][0];
    away[i] = total - home[i];
  }
  for (int i = 1; i <= n; i++) {
    cout << home[i] << " " << away[i] << endl;
  }
  return 0;
}
