#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &first, const T &second) {
  if (second < first) first = second;
}
template <class T>
inline void amax(T &first, const T &second) {
  if (first < second) first = second;
}
void solve() {
  int n;
  cin >> n;
  vector<pair<int, int> > a(n);
  map<int, int> home;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
    home[a[i].first]++;
  }
  vector<int> ret(n);
  for (int i = 0; i < n; ++i) {
    ret[i] = n - 1;
    ret[i] += home[a[i].second];
  }
  for (int i = 0; i < n; ++i) {
    cout << ret[i] << " " << 2 * (n - 1) - ret[i] << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
