#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n = 0, temp1 = 0, temp2 = 0;
  cin >> n;
  std::vector<long long int> v1;
  std::vector<long long int> v2;
  long long int hash1[100001], hash2[100001];
  for (long long int i = 0; i < 100001; ++i) {
    hash1[i] = 0;
    hash2[i] = 0;
  }
  for (long long int i = 0; i < n; ++i) {
    cin >> temp1 >> temp2;
    v1.push_back(temp1);
    v2.push_back(temp2);
  }
  for (long long int i = 0; i < n; ++i) {
    hash1[v1[i]]++;
    hash2[v2[i]]++;
  }
  for (long long int i = 0; i < n; ++i) {
    cout << (n - 1 + hash1[v2[i]]) << " " << (n - 1 - hash1[v2[i]]) << endl;
  }
  return 0;
}
