#include <bits/stdc++.h>
using namespace std;
int i, j, k;
const int N = 1e5 + 5;
int a[N], b[N], c[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    c[a[i]]++;
  }
  for (i = 0; i < n; i++) {
    cout << n - 1 + c[b[i]] << " " << n - 1 - c[b[i]] << "\n";
  }
}
