#include <bits/stdc++.h>
using namespace std;
int J[100005][2];
int home[100005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &J[i][0], &J[i][1]);
    home[J[i][0]]++;
  }
  for (int i = 0; i < n; i++) {
    int homekit = (n - 1) + home[J[i][1]];
    printf("%d %d\n", homekit, ((n - 1) << 1) - homekit);
  }
  return 0;
}
