#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> v;
int away[100005];
int main() {
  int n;
  scanf("%d", &n);
  int x[n], y[n];
  for (int i = (int)0; i < (int)n; ++i) {
    scanf("%d %d", &x[i], &y[i]);
    ++away[x[i]];
  }
  int a, h;
  for (int i = (int)0; i < (int)n; ++i) {
    a = n - 1;
    h = n - 1;
    h += away[y[i]];
    a -= away[y[i]];
    printf("%d %d\n", h, a);
  }
  return 0;
}
