#include <bits/stdc++.h>
using namespace std;
int x[100010], y[100010], n, cnt[100010];
int ans_home[100010], ans_away[100010];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &x[i], &y[i]);
  }
  for (int i = 0; i < n; i++) {
    cnt[x[i]]++;
  }
  for (int i = 0; i < n; i++) {
    ans_home[i] = n - 1;
    ans_home[i] += cnt[y[i]];
    ans_away[i] = 2 * (n - 1) - ans_home[i];
  }
  for (int i = 0; i < n; i++) printf("%d %d\n", ans_home[i], ans_away[i]);
  return 0;
}
