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