#include <bits/stdc++.h>
using namespace std;
int c1[100005], c2[100005], cnt1[100005], cnt2[100005];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    memset(cnt1, 0, sizeof(cnt1));
    memset(cnt2, 0, sizeof(cnt2));
    for (int i = 1; i <= n; i++) {
      scanf("%d%d", &c1[i], &c2[i]);
      cnt1[c1[i]]++;
      cnt2[c2[i]]++;
    }
    for (int i = 1; i <= n; i++)
      printf("%d %d\n", cnt1[c2[i]] + n - 1, 2 * n - 1 - cnt1[c2[i]] - n);
  }
  return 0;
}
