#include <bits/stdc++.h>
using namespace std;
const long long mxn = 5e5 + 5;
long long INF = 1000000000000000005LL;
void rishabh() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  rishabh();
  int n;
  cin >> n;
  vector<pair<int, int>> vec;
  map<int, int> home;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    vec.push_back({x, y});
    home[x]++;
  }
  for (int i = 0; i < n; i++) {
    int x, y;
    x = y = 0;
    x = n - 1 + home[vec[i].second];
    y = n - 1 - home[vec[i].second];
    cout << x << ' ' << y << '\n';
  }
}
