#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
int x[100000], y[100000];
int xs[100001], ys[100001];
int main() {
  int n;
  scanf("%d", &n);
  memset(xs, 0, sizeof(xs));
  memset(ys, 0, sizeof(ys));
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    scanf("%d%d", &x[i], &y[i]);
    xs[x[i]]++, ys[y[i]]++;
  }
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    int a = (n - 1) + xs[y[i]];
    int b = (n - 1) * 2 - a;
    printf("%d %d\n", a, b);
  }
  return 0;
}
