#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unordered_map<int, int> homeKit, awayKit;
  int* arr = new int[n];
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    arr[i] = b;
    homeKit[a]++;
    awayKit[b]++;
  }
  for (int i = 0; i < n; i++) {
    int collisions = homeKit[arr[i]];
    cout << n - 1 + collisions << " " << n - 1 - collisions << endl;
  }
  return 0;
}
