#include <bits/stdc++.h>
using namespace std;
long long int pw(long long int a, long long int b, long long int m) {
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return ans;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool comp(const pair<int, int> &a, const pair<int, int> &b) {
  return a.second > b.second;
}
double rnd(double var) {
  double value = (long long int)(var * 100 + .5);
  return (double)value / 100;
}
void dec(int n) {
  if (n == 0) {
    return;
  }
  dec(n - 1);
  cout << n << " ";
}
long long int const N = (1e6 + 9);
long long int primes[N + 1];
void sieve(vector<long long int> &ans) {
  memset(primes, 0, sizeof(primes));
  primes[2] = 1;
  for (long long int i = 3; i <= N; i += 2) primes[i] = 1;
  for (long long int i = 3; i <= N; i += 2) {
    if (primes[i] == 1) {
      for (long long int j = i * i; j <= N; j += i) {
        primes[j] = 0;
      }
    }
  }
  for (long long int i = 2; i <= N; i++) {
    if (primes[i] == 1) {
      ans.push_back(i);
    }
  }
}
bool is_prime(long long int a) {
  long long int lim = sqrt(a);
  for (long long int i = 2; i <= lim; i++) {
    if (a % i == 0) {
      return false;
    }
  }
  return true;
}
long long int binarysearch(vector<long long int> &arr, long long int p) {
  long long int l = 0, r = arr.size() - 1;
  long long int mid = 0;
  while (l < r) {
    mid = l + (r - l) / 2;
    if (arr[mid] * arr[mid] == p) {
      return mid;
    } else if (arr[mid] * arr[mid] > p) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  return -1;
}
int main() {
  long long int n;
  cin >> n;
  vector<long long int> home(n, 0);
  vector<long long int> away(n, 0);
  for (long long int i = 0; i < n; i++) {
    cin >> home[i];
    cin >> away[i];
  }
  vector<long long int> freq(100001, 0);
  for (long long int i = 0; i < n; i++) {
    freq[home[i]]++;
  }
  vector<pair<long long int, long long int>> hash(n, {0, 0});
  for (long long int i = 0; i < n; i++) {
    hash[i].first = n - 1 + (freq[away[i]]);
    hash[i].second = 2 * (n - 1) - hash[i].first;
  }
  for (auto x : hash) {
    cout << x.first << " " << x.second << '\n';
  }
}
