#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#define ll long long
using namespace std;
const int N=5e4+10;
ll n,sta[N],top;
ll mx;
ll read() {
ll x=0,f=1;char ch=getchar();
while((ch<'0'||ch>'9')&&(ch!=-1)) ch=getchar();
if(ch=='-') f=-1,ch=getchar();
while(ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
return x*f;
}
struct qwe {
ll x,y;
ll operator *(const qwe b)const {
return x*b.y-y*b.x;
}
qwe operator -(const qwe b) const {
qwe c;
c.x=x-b.x;c.y=y-b.y;
return c;
}
bool operator <(const qwe b)const {
if(x==b.x) return y<b.y;
return x<b.x;
}
ll operator +(const qwe b)const {
return (x-b.x)*(x-b.x)+(y-b.y)*(y-b.y);
}
}p[N];
ll sqr(qwe a,qwe b,qwe c) {return abs((b-a)*(c-b));}
void aw() {
sort(p+1,p+1+n);
top=0;
for(int i=1;i<=n;i++) {
if(top>1&&(p[sta[top]]-p[sta[top-1]])*((p[i]-p[sta[top-1]]))<=0) top--;
sta[++top]=i;
}
int k=top;
for(int i=n-1;i>=1;i--) {
if(top>k&&(p[sta[top]]-p[sta[top-1]])*((p[i]-p[sta[top-1]]))<=0) top--;
sta[++top]=i;
}
}
void xzkk() {
int j=1;
for(int i=1;i<=top;i++) {
while(sqr(p[sta[i]],p[sta[i+1]],p[sta[j]])<sqr(p[sta[i]],p[sta[i+1]],p[sta[j%top+1]])) j=j%top+1;
mx=max(mx,max(p[sta[i]]+p[sta[j]],p[sta[i+1]]+p[sta[j]]));
}
}
int main() {
n=read();
for(int i=1;i<=n;i++) p[i].x=read(),p[i].y=read();
aw();
xzkk();
printf("%lld\n",mx);
return 0;
}