//#define _GLIBCXX_DEBUG #include using namespace std; #define endl '\n' #define lfs cout<= (ll)(n); i--) using ll = long long; using ld = long double; const ll MOD1 = 1e9+7; const ll MOD9 = 998244353; const ll INF = 1e18; using P = pair; template bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;} template bool chmax(T1 &a,T2 b){if(a void ans(bool x,T1 y,T2 z){if(x)cout< void debug(vector>&v,ll h,ll w){for(ll i=0;i&v,ll h,ll w){for(ll i=0;i void debug(vector&v,ll n){if(n!=0)cout< vector>vec(ll x, ll y, T w){ vector>v(x,vector(y,w));return v;} ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;} vectordx={1,-1,0,0,1,1,-1,-1}; vectordy={0,0,1,-1,1,-1,1,-1}; template vector make_v(size_t a,T b){return vector(a,b);} template auto make_v(size_t a,Ts... ts){ return vector(a,make_v(ts...)); } template ostream &operator<<(ostream &os, const pair&p){ return os << p.first << " " << p.second; } //mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll res=0,buf=0; bool judge = true; ll n;cin>>n; ll sz=500; auto v=vec(sz+20,sz+20,-1LL); vectorax(n),ay(n); rep(i,0,n){ ll x,y;cin>>x>>y;x--;y--; ax[i]=x,ay[i]=y; v[x][y]=i; } vectorsx,sy; rep(i,-9,10)rep(j,-9,10){ if(i==0&&j==0)continue; if(i*i+j*j<100)sx.PB(i),sy.PB(j); } ll m=sx.size(); vectord(n); rep(i,0,sz)rep(j,0,sz){ if(v[i][j]==-1)continue; rep(o,0,m){ ll x=i+sx[o],y=j+sy[o]; if(x<0||y<0||v[x][y]==-1)continue; d[v[x][y]]++; } } //debug(d,n); vectorret; priority_queue,greater

>que; rep(i,0,n)que.emplace(d[i],i); while(!que.empty()){ auto p=que.top(); que.pop(); ll x=ax[p.se],y=ay[p.se]; //cout<