#include <bits/stdc++.h>   using namespace std;   bool comp(long long x, long long y) {     if (x >= y) return true;     return false;   }   bool compare(const pair<long long, long long> &i,                const pair<long long, long long> &j) {     return i.first <= j.first;   }   bool compare1(const pair<long long, long long> &i,                 const pair<long long, long long> &j) {     return i.first > j.first;   }   string decitobinary(long long n, long long bit) {     char c[bit];     memset(c,  0 , sizeof(c));     long long i = 0;     while (n > 0) {       c[i] = n % 2 + 48;       n = n / 2;       i++;     }     string s =   ;     for (long long j = bit - 1; j >= 0; j--) s += c[j];     return s;   }   long long binarytodeci(string n) {     string num = n;     long long dec_value = 0;     long long base = 1;     long long len = num.length();     for (long long i = len - 1; i >= 0; i--) {       if (num[i] ==  1 ) dec_value += base;       base = base * 2;     }     return dec_value;   }   double intlog(double base, double x) { return (log(x) / log(base)); }   long long fact(long long n) {     long long res = 1;     for (long long i = 2; i <= n; i++) res = res * i;     return res;   }   long long ncr(long long n, long long k) {     long long res = 1;     if (k > n - k) k = n - k;     for (long long i = 0; i < k; ++i) {       res *= (n - i);       res /= (i + 1);     }     return res;   }   bool ispalindrome(string str, long long l, long long h) {     while (h > l) {       if (str[l++] != str[h--]) return 0;     }     return 1;   }   long long compute_hash(string s) {     long long p = 31, hash = 0, po = 1;     for (char c : s) {       hash += (c -  a  + 1) * po % 1000000007;       po = (po * p) % 1000000007;     }     return hash;   }   vector<vector<long long>> group_identical_strings(vector<string> const &s) {     long long n = s.size();     vector<pair<long long, long long>> hashes(n);     for (long long i = 0; i < n; i++) hashes[i] = {compute_hash(s[i]), i};     sort(hashes.begin(), hashes.end());     vector<vector<long long>> groups;     for (long long i = 0; i < n; i++) {       if (i == 0 || hashes[i].first != hashes[i - 1].first) groups.emplace_back();       groups.back().push_back(hashes[i].second);     }     return groups;   }   bool isarraysort(long long a[], long long i, long long j) {     if (j == i) return 1;     if (a[j] < a[j - 1]) return 0;     return isarraysort(a, i, j - 1);   }   void sieve(long long n, long long prime[]) {     for (long long i = 1; i <= n; i++) prime[i] = 1;     for (long long p = 2; p * p <= n; p++) {       if (prime[p] == 1) {         for (long long i = p * p; i <= n; i += p) prime[i] = 0;       }     }   }   bool isprime(long long n) {     for (long long i = 2; i * i <= n; i++) {       if (n % i == 0) return 0;     }     return 1;   }   long long pow_mod(long long base, long long exp) {     long long res = 1;     while (exp > 0) {       if (exp % 2 == 1) res = (res * base) % 1000000007;       exp = exp >> 1;       base = (base * base) % 1000000007;     }     return res;   }   const long long N = 1e6 + 3;   vector<vector<long long>> adj;   bool visited[N];   long long depth[N] = {0};   long long size[N] = {0};   long long parent[N];   void dfs(long long v) {     visited[v] = true;     for (long long u : adj[v]) {       if (!visited[u]) {         dfs(u);       }     }   }   long long time_in[N], time_out[N];   long long dfs_timer = 0;   long long color[N];   void dfs_time(long long v) {     time_in[v] = ++dfs_timer;     color[v] = 1;     for (long long u : adj[v]) {       if (color[u] == 0) {         dfs_time(u);       }     }     color[v] = 2;     time_out[v] = ++dfs_timer;   }   long long count1[N];   void numberOfNodes(long long s) {     count1[s] = 1;     for (long long u : adj[s]) {       if (u == parent[s]) continue;       numberOfNodes(u);       count1[s] += count1[u];     }   }   long long call(long long a[], long long x, long long y) {     long long mxi = x;     long long mx = a[x];     for (long long i = x + 1; i <= y; i++) {       if (a[i] > mx) {         mx = a[i];         mxi = i;       }     }     return mxi;   }   void solve(long long countu) {     long long n;     cin >> n;     long long x[n], y[n];     long long cnt[100001] = {0};     for (long long i = 0; i < n; i++) {       cin >> x[i] >> y[i];       cnt[x[i]]++;     }     for (long long i = 0; i < n; i++)       cout << n - 1 + cnt[y[i]] <<     << n - 1 - cnt[y[i]] <<   n ;   }   int32_t main(void) {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long t = 1, countu = 1;     while (t--) {       solve(countu);       countu++;     }   }