#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
void solve();
int main() {
  long long t = 1;
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  while (t--) {
    solve();
  }
  return 0;
}
void solve() {
  int i, j, k;
  int n;
  cin >> n;
  vector<vector<int> > a(n, vector<int>(2));
  int m = 100001;
  vector<int> c(m);
  for (i = 0; i < n; i++) {
    cin >> a[i][0];
    cin >> a[i][1];
    c[a[i][0]]++;
  }
  for (i = 0; i < n; i++) {
    int h = n - 1, aw = n - 1;
    int d = c[a[i][1]];
    h += d;
    aw -= d;
    cout << h << ' ' << aw << '\n';
  }
}
