/* poj 2187 Beauty Contest
凸包:寻找每两点之间距离的最大值
这个最大值一定是在凸包的边缘上的!
求凸包的算法: Andrew算法!
*/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct Point{
Point(){}
Point(int x, int y){
this->x=x;
this->y=y;
}
int x, y;
static int cross(Point a, Point b){
return a.x*b.y - a.y*b.x;
}
static int dist(Point a, Point b){
return (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y);
}
Point operator -(Point tmp){
return Point(x-tmp.x, y-tmp.y);
}
};
bool cmp(Point a, Point b){
if(a.x==b.x)
return a.y<b.y;
return a.x<b.x;
}
Point p[50005];
int ch[50005];
int n;
int main(){
int i;
while(scanf("%d", &n)!=EOF){
for(i=0; i<n; ++i)
scanf("%d%d", &p[i].x, &p[i].y);
sort(p, p+n, cmp);
int m=0;
//求下凸包, 如果某一个点不在线段之内,向量的叉积必定是<=0;
for(i=0; i<n; ++i){
while(m>1 && Point::cross(p[ch[m-1]]-p[ch[m-2]], p[i]-p[ch[m-2]])<=0) m--;
ch[m++]=i;
}
//为啥求上凸包的时候,坐标的从n-2开始:因为n-1点一定是在下凸包中的(因为它的横坐标最大,必然是包含其他节点的)
int k=m;
for(i=n-2; i>=0; --i){
while(m>k && Point::cross(p[ch[m-1]]-p[ch[m-2]], p[i]-p[ch[m-2]])<=0) m--;
ch[m++]=i;
}
--m;
int maxD=-1, j, d;
for(i=0; i<m; ++i)
for(j=i+1; j<=m; ++j)
if(maxD < (d=Point::dist(p[ch[i]], p[ch[j]])))
maxD=d;
printf("%d\n", maxD);
}
return 0;
}