#include <bits/stdc++.h>
using namespace std;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  vector<pair<long long int, long long int> > v;
  map<int, int> mp;
  int n, a, b;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    v.push_back(make_pair(a, b));
    mp[a]++;
  }
  for (int i = 0; i < n; i++) {
    int x = v[i].second;
    int koto = mp[x];
    int ans1 = n - 1 + koto, ans2 = n - 1 - koto;
    cout << ans1 << " " << ans2 << endl;
  }
}
