#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int away[N + 10];
int main() {
  int n, x;
  scanf("%d", &n);
  int count[N + 10];
  memset(count, 0, sizeof(count));
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &x, &away[i]);
    count[x]++;
  }
  int maxx = (n - 1) * 2;
  for (int i = 0; i < n; ++i) {
    int ans = (n - 1) + count[away[i]];
    printf("%d %d\n", ans, maxx - ans);
  }
  return 0;
}
