#include <bits/stdc++.h>
using namespace std;
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> home(n), away(n);
  for (long long i = 0; i < n; i++) cin >> home[i] >> away[i];
  map<long long, long long> m1, m2;
  for (long long i = 0; i < n; i++) {
    m1[home[i]]++;
    m2[away[i]]++;
  }
  vector<pair<long long, long long> > ans;
  for (long long i = 0; i < n; i++) {
    long long h = 0, a = 0, factor = 0;
    if (m1.find(away[i]) != m1.end()) factor = m1[away[i]];
    h += (n - 1) + factor;
    a = n - 1 - factor;
    ans.push_back({h, a});
  }
  for (auto it : ans) {
    cout << it.first << ' ' << it.second << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  solve();
}
