#include <bits/stdc++.h>
using namespace std;
int count1[1000000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int f_sub = n;
  if (f_sub == 2) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans1 = 0;
    int ans2 = 0;
    ans1 += b == c;
    ans2 += d == a;
    int ss = 2 * (f_sub - 1);
    cout << ans1 + 1 << " " << 2 - ans1 - 1 << endl;
    cout << ans2 + 1 << " " << 2 - ans2 - 1 << endl;
    return 0;
  }
  vector<pair<int, int>> vec;
  while (n--) {
    int a, b;
    cin >> a >> b;
    count1[a]++;
    vec.push_back(make_pair(a, b));
  }
  for (auto i : vec) {
    int a1 = f_sub - 1;
    a1 += count1[i.second];
    int total = 2 * (f_sub - 1);
    cout << a1 << " " << total - a1 << endl;
  }
}
