#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 111;
int n;
int x[maxn], y[maxn];
int du[maxn], gu[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> x[i] >> y[i];
    du[x[i]]++;
    gu[y[i]]++;
  }
  for (int i = 1; i <= n; ++i) {
    int d = n - 1, g = n - 1;
    if (du[y[i]]) {
      g -= du[y[i]], d += du[y[i]];
    }
    cout << d << " " << g << endl;
  }
}
