#include <bits/stdc++.h>
using namespace std;
struct Part {
  int a, b, i;
  Part() {}
  Part(int _a, int _b, int _i) {
    a = _a;
    b = _b;
    i = _i;
  }
  bool operator<(Part X) const { return a < X.a; }
};
vector<Part> v;
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  int a, b;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    v.push_back(Part(a, b, i));
  }
  sort(v.begin(), v.end());
  pair<int, int> ss[n];
  for (int i = 0; i < v.size(); ++i) {
    std::vector<Part>::iterator low, up;
    low = lower_bound(v.begin(), v.end(), Part(v[i].b, 0, 0));
    up = upper_bound(v.begin(), v.end(), Part(v[i].b, 0, 0));
    int pa, pb;
    pa = low - v.begin();
    pb = up - v.begin();
    int dis = 0;
    if (v[pa].a == v[i].b && v[pb - 1].a == v[i].b) dis = pb - pa;
    int ans1 = n - 1 + dis;
    int ans2 = 2 * n - 1 - (ans1)-1;
    ss[v[i].i] = make_pair(ans1, ans2);
  }
  for (int i = 0; i < n; ++i) {
    cout << ss[i].first << " " << ss[i].second << endl;
  }
  return 0;
}
