#include <bits/stdc++.h>
using namespace std;
const long long int mod = (long long int)(998244353);
long long int test = 1;
vector<long long int> read(int n) {
  vector<long long int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  return v;
}
void solve() {
  long long int i, j, k, m, n, cnt = 0, ans = 0, sum = 0;
  cin >> n;
  std::vector<pair<long long int, long long int>> v(n);
  for (auto &t : v) cin >> t.first >> t.second;
  unordered_map<long long int, long long int> x;
  unordered_map<long long int, long long int> y;
  for (auto it : v) {
    x[it.first]++;
    y[it.second]++;
  }
  for (long long int i = 0; i <= n - 1; i++) {
    long long int home, away;
    home = n - 1;
    away = n - 1;
    if (x.find(v[i].second) != x.end()) {
      long long int t = x[v[i].second];
      home += t;
      away -= t;
    }
    cout << home << " " << away << "\n";
  }
  test++;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int i = 1;
  solve();
  return 0;
}
