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