1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#include "bits/stdc++.h"

using namespace std;
#define PB push_back
#define LL long long
#define int LL
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define VI vector<int>
#define PII pair<int,int>
#define LD long double

template<class C> void mini(C& a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C& a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream &os, vector<T> V){
  os<<"[";for(auto vv:V)os<<vv<<",";return os<<"]";
} 

template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}


#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

struct T{
  function<int(int,int)> upd;
  int s;
  int NONE;
  VI t;
  VI spych;
  T(function<int(int,int)> _upd, int _NONE, VI vals){
    upd = _upd;
    NONE = _NONE;
    s = 1;
    while(s < SZ(vals))
      s *= 2;
    t = VI(2 * s, NONE);
    spych = VI(2 * s, 0);
    REP(i, SZ(vals)){
      t[s + i] = vals[i];
    }
    FORD(i, s - 1, 1){
      t[i] = upd(t[2 * i], t[2 * i + 1]);
    }
  }
  void spych_down(int x){
    for(int y : {2 * x, 2 * x + 1}){
      if(t[y] == NONE)
        continue;
      t[y] += spych[x];
      spych[y] += spych[x];
    }
    spych[x] = 0;
  }
  void spych_up(int x){
    t[x] = upd(t[2 * x], t[2 * x + 1]);
  }
  int L, R;
  void add(int a, int x, int l, int r){
    if(l > R || r < L){
      return;
    }
    if(l >= L && r <= R){
      t[x] += a;
      spych[x] += a;
      return;
    }
    spych_down(x);
    int m = (l + r) / 2;
    add(a, 2 * x, l, m);
    add(a, 2 * x + 1, m + 1, r);
    spych_up(x);
  }
  void add(int a, int _L, int _R){
    L = _L;
    R = _R;
    add(a, 1, 0, s - 1);
  }
  int get_left(int a, int x, int l, int r){
    if(upd(t[x], a) != t[x]){
      return -1;
    }
    if(l == r)
      return l;
    spych_down(x);
    int m = (l + r) / 2;
    int res = get_left(a, 2 * x, l, m);
    if(res == -1){
      res = get_left(a, 2 * x + 1, m + 1, r);
    }
    return res;
  }
  int get_left(int a){
    return get_left(a, 1, 0, s - 1);
  }
  int get_right(int a, int x, int l, int r){
    if(upd(t[x], a) != t[x]){
      return -1;
    }
    if(l == r)
      return l;
    spych_down(x);
    int m = (l + r) / 2;
    int res = get_right(a, 2 * x + 1, m + 1, r);
    if(res == -1){
      res = get_right(a, 2 * x, l, m);
    }
    return res;
  }
  int get_right(int a){
    return get_right(a, 1, 0, s - 1);
  }
  int get(int a, int x, int l, int r){
    if(l == r){
      return t[x];
    }
    spych_down(x);
    int m = (l + r) / 2;
    if(a <= m){
      return get(a, 2 * x, l, m);
    } else{
      return get(a, 2 * x + 1, m + 1, r);
    }
  }
  int get(int a){
    return get(a, 1, 0, s - 1);
  }
};

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin>>n;
  VI x(n), y(n);
  REP(i, n){
    cin>>x[i]>>y[i];
  }
  REP(limak, n){
    VI res(n, 1);
    res[limak] = x[limak] * y[limak];
    for(VI v: {x, y}){
      vector<PII> info;
      REP(i, n){
        if(i != limak)
          info.push_back({v[i], i});
      }
      sort(ALL(info));
      VI loc(n);
      v.clear();
      REP(i, n - 1){
        loc[info[i].nd] = i;
        v.push_back(info[i].st);
      }
      T tmax([](int a, int b){return max(a,b);}, INT_MIN, v);
      T tmin([](int a, int b){return min(a,b);}, INT_MAX, v);
      REP(i, n){
        if(i == limak)
          continue;
        int idx = loc[i];
        int val = tmax.get(idx);
        int lidx = tmin.get_right(val - 1);
        int ridx = tmax.get_left(val + 1);
        if(lidx != -1){
          tmin.add(1, 0, lidx);
          tmax.add(1, 0, lidx);
        }
        if(ridx != -1){
          tmin.add(-1, ridx, n - 2);
          tmax.add(-1, ridx, n - 2);
        }
      }
      REP(i, n - 1){
        int val = tmax.get(i);
        res[info[i].nd] *= val;
      }
    }
    int sum = accumulate(ALL(res), 0);
    cout<<sum<<"\n";
  }

}