#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> v;
vector<string> v3, v1;
map<int, int> m2, m;
int n, i, j, cnt = 0, sum[100000], a, b;
string s, s1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    v.push_back(make_pair(a, b));
    m[v[i].first]++;
  }
  for (i = 0; i < n; i++) {
    sum[i] = n - 1;
  }
  for (i = 0; i < n; i++) {
    sum[i] += m[v[i].second];
  }
  for (i = 0; i < n; i++) {
    cout << sum[i] << " " << 2 * (n - 1) - sum[i] << endl;
  }
}
