#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> x(n), y(n), cnt(int(1e5 + 1), 0);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    cnt[x[i]]++;
  }
  vector<int> ans_home(n), ans_away(n);
  for (int i = 0; i < n; i++) {
    ans_home[i] = n - 1;
    ans_home[i] += cnt[y[i]];
    ans_away[i] = (n - 1) - cnt[y[i]];
  }
  for (int i = 0; i < n; i++) {
    cout << ans_home[i] << " " << ans_away[i] << "\n";
  }
}
