#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int x[N];
int y[N];
int arr1[N];
int arr2[N];
int n, k;
int main() {
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      int a, b;
      cin >> a >> b;
      arr1[i] = a;
      arr2[i] = b;
      x[a]++;
      y[b]++;
    }
    vector<int> retx(n, n - 1);
    vector<int> rety(n, n - 1);
    for (int i = 0; i < n; i++) {
      int color = arr2[i];
      int cnt = x[color];
      retx[i] += cnt;
      rety[i] -= cnt;
    }
    for (int i = 0; i < n; i++) printf("%d %d\n", retx[i], rety[i]);
    return 0;
  }
  return 0;
}
