#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 7;
long long n, a, b, cnt, ans, sum;
map<long long, long long> mp, pm;
deque<pair<long long, long long> > pr, rp;
void DNM() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b;
    rp.push_back({a, b});
    pr.push_back({0, 0});
    mp[a]++;
    pm[b]++;
  }
  for (long long i = 0; i < pr.size(); i++) {
    pr[i].first = n - 1;
    pr[i].first += mp[rp[i].second];
    pr[i].second = (n - 1) - mp[rp[i].second];
  }
  for (auto i : pr) cout << i.first << " " << i.second << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int Qu_l_uQ = 1;
  while (Qu_l_uQ--) DNM();
}
