思路:记录下每行每列的个数,当计算总长度时候,左右是否有方块有方块就-2,只要有重合的地方就-2
#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<stack>
#include<string>
#include<algorithm>
#include<unordered_map>
#include<map>
#include<cstring>
#include <unordered_set>
//#include<priority_queue>
#include<queue>
#include<set>
#include<stdlib.h>
#define dbug cout<<"hear!"<<endl;
#define rep(a,b,c) for(ll a=b;a<=c;a++)
#define per(a,b,c) for(ll a=b;a>=c;a--)
#define no cout<<"NO"<<endl;
#define yes cout<<"YES"<<endl;
#define endl "\n"
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//priority_queue<int,vector<int>,greater<int> >q;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> PII;
typedef pair<long double,long double> PDD;
ll INF = 0x3f3f3f3f;
//const ll LINF=LLONG_MAX;
const ll N = 2e6+ 10;
const ll mod =998244353;
ll t,n,m,x,y,ca;
ll arr[N],brr[N],crr[N];
//ll book[N];
void fatchuan()
{
cin>>n;
map<int,int>left,right;
ll ans1 =0 ,ans2 = 0;
rep(i,1,n)
{
ans1 += 4, ans2 += 4;
int x,y;
cin >> x >> y;
left[x]++,right[y]++;
if(left[x]>1)ans1 -= 2;
if(right[y]>1)ans2 -= 2;
if(right[y+1]>=right[y])ans2 -= 2;
if(right[y-1]>=right[y] && y-1 !=0)ans2 -= 2;
if(left[x-1] >= left[x] && x-1 !=0)ans1 -= 2;
if(left[x+1] >= left[x])ans1 -= 2;
cout<<ans1<<' '<<ans2<<endl;
}
}
int main()
{
IOS;
t=1;
//scanf("%d",&t);
//cin>>t;
ca=1;
while(t--)
{
fatchuan();
ca++;
}
return 0;
}