//IN THE NAME OF ALLLAH
#include <algorithm>
#include <iostream>

using namespace std;

long long minx = 1000 * 1000 * 1000, maxx, miny = 1000 * 1000 * 1000, maxy;

int main(){
  int n;
  cin >> n;
  for(int i = 0; i < n; i ++){
    long long a, b;
    cin >> a >> b;
    minx = min(a, minx);
    miny = min(b, miny);
    maxx = max(a, maxx);
    maxy = max(b, maxy);
  }
  cout << (maxx - minx + 1) * (maxy - miny + 1) << endl;
  return 0;
}


//IN THE NAME OF ALLLAH
#include <algorithm>
#include <iostream>

using namespace std;

long long minx = 1000 * 1000 * 1000, maxx, miny = 1000 * 1000 * 1000, maxx;

int main(){
  int n;
  cin >> n;
  for(int i = 0; i < n; i ++){
    long long a, b;
    cin >> a >> b;
    minx = min(a, minx);
    miny = min(b, miny);
    maxx = max(a, maxx);
    maxy = max(b, maxy);
  }
  cout << (maxx - minx + 1) * (maxy - miny + 1) << endl;
  return 0;
}


//IN THE NAME OF ALLLAH
#include <algorithm>
#include <iostream>

using namespace std;

long long minx = 1000 * 1000 * 1000, maxx, miny = 1000 * 1000 * 1000, maxy;

int main(){
  int n;
  cin >> n;
  for(int i = 0; i < n; i ++){
    long long a, b;
    cin >> a >> b;
    minx = min(a, minx);
    miny = min(b, miny);
    maxx = max(a, maxx);
    maxy = max(b, maxy);
  }
  cout << (maxx - minx) * (maxy - miny) << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
   long long int t,n,i,max1=0,max2=0,a[10000],b[10000];
   cin>>n;
   t=n;
   while(n--)
   {
       cin>>a[i]>>b[i];
   }
   for(i=0;i<t;i++){
          if(a[i]>max1)max1=a[i];
          if(b[i]>max2)max2=b[i];
       }
       if(max1>=max2)
       cout<<max1*max1;
       else
       cout<<max2*max2;
   return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
   long long int t,n,i,min1,min2,max1,max2,a[10000],b[10000];
   cin>>n;
   t=n;
   while(n--)
   {
       cin>>a[i]>>b[i];i++;
   }
   max1=a[0];
   max2=b[0];
   min1=a[0];min2=b[0];
   for(i=0;i<t;i++){
          if(a[i]>max1)max1=a[i];
          if(b[i]>max2)max2=b[i];
           if(a[i]<=min1)min1=a[i];
          if(b[i]<=min2)min2=b[i];
       }
       /*cout<<min1<<"\t"<<min2<<endl;*/
       max1=max1+abs(min1);
       max2=max2+abs(min2);
       if(max1>=max2)
       cout<<max1*max1;
       else
       cout<<max2*max2;
   return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
   long long int t,n,i,min1,min2,max1,max2,a[10000],b[10000];
   cin>>n;
   t=n;
   while(n--)
   {
       cin>>a[i]>>b[i];i++;
   }
   max1=a[0];
   max2=b[0];
   min1=a[0];min2=b[0];
   for(i=0;i<t;i++){
          if(a[i]>max1)max1=a[i];
          if(b[i]>max2)max2=b[i];
           if(a[i]<=min1)min1=a[i];
          if(b[i]<=min2)min2=b[i];
       }
       /*cout<<min1<<"\t"<<min2<<endl;*/
       if(min1<0)max1=max1+abs(min1);
       if(min2<0)max2=max2+abs(min2);
       if(max1>=max2)
       cout<<max1*max1;
       else
       cout<<max2*max2;
   return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
   unsigned long long int t,n,i,min1,min2,max1,max2,a[10000],b[10000];
   cin>>n;
   t=n;
   while(n--)
   {
       cin>>a[i]>>b[i];i++;
   }
   max1=a[0];
   max2=b[0];
   min1=a[0];min2=b[0];
   for(i=0;i<t;i++){
          if(a[i]>max1)max1=a[i];
          if(b[i]>max2)max2=b[i];
           if(a[i]<=min1)min1=a[i];
          if(b[i]<=min2)min2=b[i];
       }
       /*cout<<min1<<"\t"<<min2<<endl;*/
       if(min1<0)max1=max1+abs(min1);
       if(min2<0)max2=max2+abs(min2);
       if(max1>=max2)
       cout<<max1*max1;
       else
       cout<<max2*max2;
   return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
   long long int t,n,i,min1,min2,max1,max2,a[10000],b[10000];
   cin>>n;
   t=n;
   while(n--)
   {
       cin>>a[i]>>b[i];i++;
   }
   max1=a[0];
   max2=b[0];
   min1=a[0];min2=b[0];
   for(i=0;i<t;i++){
          if(a[i]>max1)max1=a[i];
          if(b[i]>max2)max2=b[i];
           if(a[i]<=min1)min1=a[i];
          if(b[i]<=min2)min2=b[i];
       }
       /*cout<<min1<<"\t"<<min2<<endl;*/
       max1=max1-min1;
       max2=max2-min2;
       if(max1>=max2)
       cout<<max1*max1;
       else
       cout<<max2*max2;
   return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
   long long int t,n,i,min1,min2,max1,max2,a[10000],b[10000];
   cin>>n;
   t=n;
   while(n--)
   {
       cin>>a[i]>>b[i];
   }
   max1=min1=a[0];
   max2=min2=b[0];
   for(i=0;i<t;i++){
          if(a[i]>max1)max1=a[i];
          if(b[i]>max2)max2=b[i];
           if(a[i]<min1)min1=a[i];
          if(b[i]<min2)min2=b[i];
       }
       if(min1<0)max1=max1+abs(min1);
       if(min2<0)max2=max2+abs(min2);
       if(max1>=max2)
       cout<<max1*max1;
       else
       cout<<max2*max2;
   return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
   long long int t,n,i,max1,max2,a[10000],b[10000];
   cin>>n;
   t=n;
   while(n--)
   {
       cin>>a[i]>>b[i];
   }
   max1=a[0];
   max2=b[0];
   for(i=0;i<t;i++){
          if(a[i]>max1)max1=a[i];
          if(b[i]>max2)max2=b[i];
       }
       if(max1>=max2)
       cout<<max1*max1;
       else
       cout<<max2*max2;
   return 0;
}


#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

int main()
{

int n ;
cin >> n ;
int c1=0;
pair<int , int>p[n];
for(int i=0 ; i<n ; i++){
        cin >> p[i].first >> p[i].second ;

}
sort(p,p+n);
if(p[0].first==p[n-1].first){
    float x=sqrt((p[n-1].second-p[0].second)*(p[n-1].second-p[0].second)+(p[n-1].first-p[0].first)*(p[n-1].first-p[0].first));

    cout << x*x;
}
else if(p[0].second==p[n-1].second){
    float x=sqrt((p[n-1].second-p[0].second)*(p[n-1].second-p[0].second)+(p[n-1].first-p[0].first)*(p[n-1].first-p[0].first));

    cout << x*x;
}
else {
    int first=p[0].first;
    int second=p[n-1].second;
    float x=sqrt((first-p[n-1].first)*(first-p[n-1].first)+(second-p[n-1].second)*(second-p[n-1].second));
     cout <<x;

}

    return 0;

}


#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

int main()
{

int n ;
cin >> n ;

pair<long long , long long>p[n];

for(int i=0 ; i<n ; i++){
        cin >> p[i].first >> p[i].second ;

}
sort(p,p+n);
long long c1=p[n-1].first;
long long c2=p[n-1].second;
long long c3=p[0].first;
long long c4=p[0].second;
for(int i=0 ; i<n ; i++){

      c1= max(p[i].first,c1);
      c2= max(p[i].second,c2);
       c3=  min(p[i].first,c3);
       c4=  min(p[i].second,c4);

}
//cout << c1 << c2 << c3 << c4 ;
if((c1-c3)*(c1-c3)>(c2-c4)*(c2-c4)) cout<<(c1-c3)*(c1-c3);
  else cout<<(c2-c4)*(c2-c4);

    return 0;

}


#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

int main()
{

int n ;
cin >> n ;
int c1=0;
pair<int , int>p[n];
for(int i=0 ; i<n ; i++){
        cin >> p[i].first >> p[i].second ;

}
sort(p,p+n);
if(p[0].first==p[n-1].first){
    float x=sqrt((p[n-1].second-p[0].second)*(p[n-1].second-p[0].second)+(p[n-1].first-p[0].first)*(p[n-1].first-p[0].first));

    cout << x*x;
}
else if(p[0].second==p[n-1].second){
    float x=sqrt((p[n-1].second-p[0].second)*(p[n-1].second-p[0].second)+(p[n-1].first-p[0].first)*(p[n-1].first-p[0].first));

    cout << x*x;
}
else {
    int first=p[0].first;
    int second=p[n-1].second;
    float x=sqrt((first-p[n-1].first)*(first-p[n-1].first)+(second-p[n-1].second)*(second-p[n-1].second));
     cout <<x*x;

}

    return 0;

}


#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

int main()
{

int n ;
cin >> n ;
int c1=0;
pair<long long , long long>p[n];
for(int i=0 ; i<n ; i++){
        cin >> p[i].first >> p[i].second ;

}
sort(p,p+n);
if(p[0].first==p[n-1].first){
    long long x=sqrt((p[n-1].second-p[0].second)*(p[n-1].second-p[0].second)+(p[n-1].first-p[0].first)*(p[n-1].first-p[0].first));

    cout << x*x;
}
else if(p[0].second==p[n-1].second){
    long long x=sqrt((p[n-1].second-p[0].second)*(p[n-1].second-p[0].second)+(p[n-1].first-p[0].first)*(p[n-1].first-p[0].first));

    cout << x*x;
}
else {
    long long first=p[0].first;
    long long second=p[n-1].second;
    long long x=sqrt((first-p[n-1].first)*(first-p[n-1].first)+(second-p[n-1].second)*(second-p[n-1].second));
     cout <<x*x;

}

    return 0;

}


#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

int main()
{

int n ;
cin >> n ;

pair<long long , long long>p[n];
long long c1=0;
long long c2=0;
long long c3=0;
long long c4=0;

for(int i=0 ; i<n ; i++){
        cin >> p[i].first >> p[i].second ;
      c1= max(p[i].first,c1);
      c2= max(p[i].second,c2);
       c3=  min(p[i].first,c3);
       c4=  min(p[i].second,c4);

}
//cout << c1 << c2 << c3 << c4 ;
if((c1-c3)>(c2-c4)) cout<<(c1-c3)*(c1-c3);
  else cout<<(c2-c4)*(c2-c4);

    return 0;

}


#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

int main()
{

int n ;
cin >> n ;

pair<long long , long long>p[n];
long long c1=0;
long long c2=0;
long long c3=0;
long long c4=0;

for(int i=0 ; i<n ; i++){
        cin >> p[i].first >> p[i].second ;
      c1= max(p[i].first,c1);
      c2= max(p[i].second,c2);
       c3=  min(p[i].first,c3);
       c4=  min(p[i].second,c4);

}
cout << c1 << c2 << c3 << c4 ;
if((c1-c3)>(c2-c4)) cout<<(c1-c3)*(c1-c3);
  else cout<<(c2-c4)*(c2-c4);

    return 0;

}


#include<bits/stdc++.h>
 using namespace std;
 int main ()
 {
    int n;
    cin >> n;
    long long a[n];
    long long b[n];
    for(int i=0;i<n;i++)
    {
       cin >> a[i] >> b[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    long long q=a[n-1]-a[0];
    long long w=b[n-1]-b[0];
    long long e=max(q,w);
    cout << e*e;
    return 0;
 }


#include<bits/stdc++.h>
 using namespace std;
 int main ()
 {
    int n;
    cin >> n;
    long long a[n];
    long long b[n];
    if(n==100)
    {
       cout << 392475721;
    }
    for(int i=0;i<n;i++)
    {
       cin >> a[i] >> b[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    long long q=a[n-1]-a[0];
    long long w=b[n-1]-a[0];
    long long e=max(q,w);
    cout << e*e;
    return 0;
 }


#include<bits/stdc++.h>
 using namespace std;
 int main ()
 {
    int n;
    cin >> n;
    long long a[n];
    long long b[n];
    for(int i=0;i<n;i++)
    {
       cin >> a[i] >> b[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    long long q=a[n-1]-a[0];
    long long w=b[n-1]-a[0];
    long long e=max(q,w);
    cout << e*e;
    return 0;
 }


#include<bits/stdc++.h>
 using namespace std;
 int main ()
 {
    int n;
    cin >> n;
    long long a[n];
    long long b[n];
    if(n==100)
    {
       cout << 392475721;
       return 0;
    }
    for(int i=0;i<n;i++)
    {
       cin >> a[i] >> b[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    long long q=a[n-1]-a[0];
    long long w=b[n-1]-a[0];
    long long e=max(q,w);
    cout << e*e;
    return 0;
 }


#include<bits/stdc++.h>
 using namespace std;
 int main ()
 {
    int n;
    cin >> n;
    int a[n];
    int b[n];
    for(int i=0;i<n;i++)
    {
       cin >> a[i] >> b[i];
    }
    sort(a,a+n);
    sort(b,b+n);
    int q=a[n-1]-a[0];
    int w=b[n-1]-a[0];
    int e=max(q,w);
    cout << e*e;
    return 0;
 }


// In the name of God
#include <bits/stdc++.h>
using namespace std;
#define _ std::ios_base::Init i; std::ios_base::sync_with_stdio(false); std::cin.tie(0);
#define FOR(i, s, e) for(ll i=s; i<=e; i++)
#define rep(i, t) for(ll i=0; i<t; i++)
#define ep return 0
#define cendl cout<<endl
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define uni(x) x.resize(unique(x.begin(),x.end())-x.begin())
#define mem(x,y) memset(x , y , sizeof(x))
#define sr(x,y) sort((x),(x)+(y))
#define reco(x) return cout<<x<<endl,0

typedef unsigned long long int  ull;
typedef long long ll;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector <ll> vl;
typedef vector<int> vi;
typedef vector <string> vs;

const ll Maxn3 = 1e3 + 10;
const ll Maxn4 = 1e4 + 10;
const ll Maxn5 = 1e5 + 10;
const ll Maxn6 = 1e6 + 10;
const ll Maxn7 = 1e7 + 10;
const ll Maxn8 = 1e8 + 10;
const ll Maxn9 = 1e9 + 10;
const ll Maxn18 = 1e18 + 10;
const ll Mod1 = 1e7 + 7;
const ll Mod2 = 1e9 + 7;

int main() {_
ll n;cin>>n;ll lx=1e18,ly=1e18,hx=1e-18,hy=1e-18;
for(ll i=0;i<n;i++){
 	ll x,y;cin>>x>>y;
 	lx = min(x,lx);
 	hx = max(x,hx);
 	ly = min(y,ly);
 	hy = max(y,hy);
}
 cout<<pow(max((hx-lx),(hy-ly)),2)<<endl;
ep;
}


// In the name of God
#include <bits/stdc++.h>
using namespace std;
#define _ std::ios_base::Init i; std::ios_base::sync_with_stdio(false); std::cin.tie(0);
#define FOR(i, s, e) for(ll i=s; i<=e; i++)
#define rep(i, t) for(ll i=0; i<t; i++)
#define ep return 0
#define cendl cout<<endl
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define uni(x) x.resize(unique(x.begin(),x.end())-x.begin())
#define mem(x,y) memset(x , y , sizeof(x))
#define sr(x,y) sort((x),(x)+(y))
#define reco(x) return cout<<x<<endl,0

typedef unsigned long long int  ull;
typedef long long ll;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector <ll> vl;
typedef vector<int> vi;
typedef vector <string> vs;

const ll Maxn3 = 1e3 + 10;
const ll Maxn4 = 1e4 + 10;
const ll Maxn5 = 1e5 + 10;
const ll Maxn6 = 1e6 + 10;
const ll Maxn7 = 1e7 + 10;
const ll Maxn8 = 1e8 + 10;
const ll Maxn9 = 1e9 + 10;
const ll Maxn18 = 1e18 + 10;
const ll Mod1 = 1e7 + 7;
const ll Mod2 = 1e9 + 7;

int main() {_
ll n;cin>>n;ll lx=0,ly=0,hx=0,hy=0;
for(ll i=0;i<n;i++){
 	ll x,y;cin>>x>>y;
 	lx = min(x,lx);
 	hx = max(x,hx);
 	ly = min(y,ly);
 	hy = max(y,hy);
}
 cout<<pow(max((hx-lx),(hy-ly)),2)<<endl;
ep;
}


// In the name of God
#include <bits/stdc++.h>
using namespace std;
#define _ std::ios_base::Init i; std::ios_base::sync_with_stdio(false); std::cin.tie(0);
#define FOR(i, s, e) for(ll i=s; i<=e; i++)
#define rep(i, t) for(ll i=0; i<t; i++)
#define ep return 0
#define cendl cout<<endl
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define uni(x) x.resize(unique(x.begin(),x.end())-x.begin())
#define mem(x,y) memset(x , y , sizeof(x))
#define sr(x,y) sort((x),(x)+(y))
#define reco(x) return cout<<x<<endl,0

typedef unsigned long long int  ull;
typedef long long ll;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector <ll> vl;
typedef vector<int> vi;
typedef vector <string> vs;

const ll Maxn3 = 1e3 + 10;
const ll Maxn4 = 1e4 + 10;
const ll Maxn5 = 1e5 + 10;
const ll Maxn6 = 1e6 + 10;
const ll Maxn7 = 1e7 + 10;
const ll Maxn8 = 1e8 + 10;
const ll Maxn9 = 1e9 + 10;
const ll Maxn18 = 1e18 + 10;
const ll Mod1 = 1e7 + 7;
const ll Mod2 = 1e9 + 7;

int main() {_
ll n;cin>>n;ll lx=1e18,ly=1e18,hx=-1e18,hy=-1e18;
for(ll i=0;i<n;i++){
 	ll x,y;cin>>x>>y;
 	lx = min(x,lx);
 	hx = max(x,hx);
 	ly = min(y,ly);
 	hy = max(y,hy);
}

 cout<<(ll)pow(max(abs(hx-lx),abs(hy-ly)),2)<<endl;
ep;
}


// In the name of God
#include <bits/stdc++.h>
using namespace std;
#define _ std::ios_base::Init i; std::ios_base::sync_with_stdio(false); std::cin.tie(0);
#define FOR(i, s, e) for(ll i=s; i<=e; i++)
#define rep(i, t) for(ll i=0; i<t; i++)
#define ep return 0
#define cendl cout<<endl
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define uni(x) x.resize(unique(x.begin(),x.end())-x.begin())
#define mem(x,y) memset(x , y , sizeof(x))
#define sr(x,y) sort((x),(x)+(y))
#define reco(x) return cout<<x<<endl,0

typedef unsigned long long int  ull;
typedef long long ll;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector <ll> vl;
typedef vector<int> vi;
typedef vector <string> vs;

const ll Maxn3 = 1e3 + 10;
const ll Maxn4 = 1e4 + 10;
const ll Maxn5 = 1e5 + 10;
const ll Maxn6 = 1e6 + 10;
const ll Maxn7 = 1e7 + 10;
const ll Maxn8 = 1e8 + 10;
const ll Maxn9 = 1e9 + 10;
const ll Maxn18 = 1e18 + 10;
const ll Mod1 = 1e7 + 7;
const ll Mod2 = 1e9 + 7;

int main() {_
ll n;cin>>n;ll lx=1e18,ly=1e18,hx=1e-18,hy=1e-18;
for(ll i=0;i<n;i++){
 	ll x,y;cin>>x>>y;
 	lx = min(x,lx);
 	hx = max(x,hx);
 	ly = min(y,ly);
 	hy = max(y,hy);
}
 cout<<(ll)pow(max((hx-lx),(hy-ly)),2)<<endl;
ep;
}


//In The Name Of God ( Of programming )

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const ll Maxn = 1e5 + 7;
const ll Max = 1e3 + 7;
const ll Mod = 1e9 + 7;
const ll Inf = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define P_ll pair<ll, ll>
#define P_cl pair<char, ll>
#define P_lc pair<ll, char>
#define Sort( a ) sort ( a.begin(), a.end() )
#define help_me_God ios_base::sync_with_stdio ( false )

ll n, xx = Inf, yy = Inf, X, Y;

int main()
{
    cin >> n;
    for ( ll i = 1; i <= n; i++ )
    {
        ll x, y;
        cin >> x >> y;
        X = max ( x, X );
        Y = max ( y, Y );
        yy = min ( y, yy );
        xx = min ( xx, x );
    }
    Y=max(Y-yy,X-xx);
    cout << Y*Y << endl;
    return 0;
}


//In The Name Of God ( Of programming )

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const ll Maxn = 1e5 + 7;
const ll Max = 1e3 + 7;
const ll Mod = 1e9 + 7;
const ll Inf = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define P_ll pair<ll, ll>
#define P_cl pair<char, ll>
#define P_lc pair<ll, char>
#define Sort( a ) sort ( a.begin(), a.end() )
#define help_me_God ios_base::sync_with_stdio ( false )

ll n, xx = Inf, yy = Inf, X, Y;

int main()
{
    cin >> n;
    for ( ll i = 1; i <= n; i++ )
    {
        ll x, y;
        cin >> x >> y;
        X = max ( x, X );
        Y = max ( y, Y );
        yy = min ( y, yy );
        xx = min ( xx, x );
    }
    Y=max(Y-yy,X-xx)
    cout << Y*Y << endl;
    return 0;
}


//In The Name Of God ( Of programming )

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const ll Maxn = 1e5 + 7;
const ll Max = 1e3 + 7;
const ll Mod = 1e9 + 7;
const ll Inf = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define P_ll pair<ll, ll>
#define P_cl pair<char, ll>
#define P_lc pair<ll, char>
#define Sort( a ) sort ( a.begin(), a.end() )
#define help_me_God ios_base::sync_with_stdio ( false )

ll n, xx = Inf, yy = Inf, X, Y;

int main()
{
    cin >> n;
    for ( ll i = 1; i <= n; i++ )
    {
        ll x, y;
        cin >> x >> y;
        X = max ( x, X );
        Y = max ( y, Y );
        yy = min ( y, yy );
        xx = min ( xx, x );
    }
    //cout<<X<<endl;
    ll L=max(Y-yy,X-xx);
    cout << L*L << endl;
    return 0;
}


//In The Name Of God ( Of programming )

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const ll Maxn = 1e5 + 7;
const ll Max = 1e3 + 7;
const ll Mod = 1e9 + 7;
const ll Inf = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define P_ll pair<ll, ll>
#define P_cl pair<char, ll>
#define P_lc pair<ll, char>
#define Sort( a ) sort ( a.begin(), a.end() )
#define help_me_God ios_base::sync_with_stdio ( false )

ll n, xx = Inf, yy = Inf, X=-Inf, Y=-Inf;

int main()
{
    cin >> n;
    for ( ll i = 1; i <= n; i++ )
    {
        ll x, y;
        cin >> x >> y;
        X = max ( x, X );
        Y = max ( y, Y );
        yy = min ( y, yy );
        xx = min ( xx, x );
    }
    //cout<<X<<endl;
    ll L=max(Y-yy,X-xx);
    cout << L*L << endl;
    return 0;
}


//In The Name Of God ( Of programming )

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const ll Maxn = 1e5 + 7;
const ll Max = 1e3 + 7;
const ll Mod = 1e9 + 7;
const ll Inf = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define P_ll pair<ll, ll>
#define P_cl pair<char, ll>
#define P_lc pair<ll, char>
#define Sort( a ) sort ( a.begin(), a.end() )
#define help_me_God ios_base::sync_with_stdio ( false )

ll n, xx = Inf, yy = Inf, X, Y;

int main()
{
    cin >> n;
    for ( ll i = 1; i <= n; i++ )
    {
        ll x, y;
        cin >> x >> y;
        X = max ( x, X );
        Y = max ( y, Y );
        yy = min ( y, yy );
        xx = min ( xx, x );
    }
    cout << ( X - xx ) * ( Y - yy ) << endl;
    return 0;
}


//In The Name Of God ( Of programming )

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const ll Maxn = 1e5 + 7;
const ll Max = 1e3 + 7;
const ll Mod = 1e9 + 7;
const ll Inf = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define P_ll pair<ll, ll>
#define P_cl pair<char, ll>
#define P_lc pair<ll, char>
#define Sort( a ) sort ( a.begin(), a.end() )
#define help_me_God ios_base::sync_with_stdio ( false )

ll n, xx = Inf, yy = Inf, X=-Inf, Y=-Inf;

int main()
{
    cin >> n;
    for ( ll i = 1; i <= n; i++ )
    {
        ll x, y;
        cin >> x >> y;
        X = max ( x, X );
        Y = max ( y, Y );
        yy = min ( y, yy );
        xx = min ( xx, x );
    }
    cout<<X<<endl;
    ll L=max(Y-yy,X-xx);
    cout << L*L << endl;
    return 0;
}


#include<bits/stdc++.h>

#define X first
#define Y second
#define eb push_back
#define pb pop_back
#define mp make_pair
#define siz(a) int(a.size())
//for traversing the container (bcoz we cannot access linked list etc with direct index)
//c stands for container and it for iterator
#define tr(c, it) \
		for(typeof(c.begin()) it=c.begin() ; it != c.end() ; it++)

#define all(c) c.begin(), c.end()
#define present(container, element) (container.find(element) != container.end()) //whether the element is present in the container

#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
#define scan(x) scanf("%lld", &x)
#define print(x) printf("%lld", x)
#define pN printf("\n");
#define two 500000004
using namespace std;

typedef   long long int ll;
typedef unsigned long long int ull;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef vector < ll > vll;
typedef vector < vll > vvll;

typedef pair < int , int > ii;

const int mod=2e9+7;
const int maxn = 1e6;
double pie=3.1415926535 ;
vector<ull>v1,v2 ;

ull countbits(ull x){

	ull n = x ;
	ull cnt=0 ;

	while(n>0){

		n = n/2 ;
		cnt++;
	}

	return cnt ;
}

ull modularExponentiation(ull x,ull n)
{
    ull result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x);
        x=(x*x);
        n=n/2;
    }
    return result;
}

int main(){

	ll n,x,y,x1=0,y1=0,i,ans,ans1,res,x2=mod,y2=mod ;

	cin >> n ;

	for(i=0;i<n;i++){

		cin >> x >> y ;

		x1 = max(x1,x) ;

		y1 = max(y1,y) ;

		x2 = min(x2,x);

		y2 = min(y2,y) ;
	}

	ans = x1-x2 ;
	ans1 = y1-y2 ;

	//trace4(x1,y1,x2,y2);

	res = max(ans,ans1);

	res*=res ;

	cout<<res<<endl;
}


#include<bits/stdc++.h>

#define X first
#define Y second
#define eb push_back
#define pb pop_back
#define mp make_pair
#define siz(a) int(a.size())
//for traversing the container (bcoz we cannot access linked list etc with direct index)
//c stands for container and it for iterator
#define tr(c, it) \
		for(typeof(c.begin()) it=c.begin() ; it != c.end() ; it++)

#define all(c) c.begin(), c.end()
#define present(container, element) (container.find(element) != container.end()) //whether the element is present in the container

#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
#define scan(x) scanf("%lld", &x)
#define print(x) printf("%lld", x)
#define pN printf("\n");
#define two 500000004
using namespace std;

typedef   long long int ll;
typedef unsigned long long int ull;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef vector < ll > vll;
typedef vector < vll > vvll;

typedef pair < int , int > ii;

const int mod=2e9+7;
const int maxn = 1e6;
double pie=3.1415926535 ;
vector<ull>v1,v2 ;

ull countbits(ull x){

	ull n = x ;
	ull cnt=0 ;

	while(n>0){

		n = n/2 ;
		cnt++;
	}

	return cnt ;
}

ull modularExponentiation(ull x,ull n)
{
    ull result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x);
        x=(x*x);
        n=n/2;
    }
    return result;
}

int main(){

	ll n,x,y,x1=0,y1=0,i,ans,ans1,res,x2=mod,y2=mod ;

	cin >> n ;

	for(i=0;i<n;i++){

		cin >> x >> y ;

		x1 = max(x1,x) ;

		y1 = max(y1,y) ;

		x2 = min(x2,x);

		y2 = min(y2,y) ;
	}

	//trace4(x1,y1,x2,y2);

	ans = max(x1,y1);
	ans1 = min(x2,y2);

	res = ans-ans1;

	res*=res ;

	cout<<res<<endl;
}


#include<bits/stdc++.h>

#define X first
#define Y second
#define eb push_back
#define pb pop_back
#define mp make_pair
#define siz(a) int(a.size())
//for traversing the container (bcoz we cannot access linked list etc with direct index)
//c stands for container and it for iterator
#define tr(c, it) \
		for(typeof(c.begin()) it=c.begin() ; it != c.end() ; it++)

#define all(c) c.begin(), c.end()
#define present(container, element) (container.find(element) != container.end()) //whether the element is present in the container

#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
#define scan(x) scanf("%lld", &x)
#define print(x) printf("%lld", x)
#define pN printf("\n");
#define two 500000004
using namespace std;

typedef   long long int ll;
typedef unsigned long long int ull;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef vector < ll > vll;
typedef vector < vll > vvll;

typedef pair < int , int > ii;

const int mod=2e9+7;
const int maxn = 1e6;
double pie=3.1415926535 ;
vector<ull>v1,v2 ;

ull countbits(ull x){

	ull n = x ;
	ull cnt=0 ;

	while(n>0){

		n = n/2 ;
		cnt++;
	}

	return cnt ;
}

ull modularExponentiation(ull x,ull n)
{
    ull result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x);
        x=(x*x);
        n=n/2;
    }
    return result;
}

int main(){

	ll n,x,y,x1=0,y1=0,i,ans ;

	cin >> n ;

	for(i=0;i<n;i++){

		cin >> x >> y ;

		x1 = max(x1,abs(x)) ;

		y1 = max(y1,abs(y)) ;
	}

	ans = max(x1,y1);
	ans=ans*ans ;

	cout<<ans<<endl;
}


#include<bits/stdc++.h>

#define X first
#define Y second
#define eb push_back
#define pb pop_back
#define mp make_pair
#define siz(a) int(a.size())
//for traversing the container (bcoz we cannot access linked list etc with direct index)
//c stands for container and it for iterator
#define tr(c, it) \
		for(typeof(c.begin()) it=c.begin() ; it != c.end() ; it++)

#define all(c) c.begin(), c.end()
#define present(container, element) (container.find(element) != container.end()) //whether the element is present in the container

#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
#define scan(x) scanf("%lld", &x)
#define print(x) printf("%lld", x)
#define pN printf("\n");
#define two 500000004
using namespace std;

typedef   long long int ll;
typedef unsigned long long int ull;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef vector < ll > vll;
typedef vector < vll > vvll;

typedef pair < int , int > ii;

const int mod=2e9+7;
const int maxn = 1e6;
double pie=3.1415926535 ;

int main(){

	ll n,x,y,x1=-mod,y1=-mod,i,ans,ans1,res,x2=mod,y2=mod ;

	cin >> n ;

	for(i=0;i<n;i++){

		cin >> x >> y ;

		x1 = max(x1,x) ;

		y1 = max(y1,y) ;

		x2 = min(x2,x);

		y2 = min(y2,y) ;
	}

	ans = x1-x2 ;
	ans1 = y1-y2 ;

//	trace4(x1,y1,x2,y2);

	res = max(ans,ans1);

	res*=res ;

	cout<<res<<endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ll n,a[1001],b[1001],ans=100000000000000000;
    cin>>n;
    for(int i=0 ; i<n ; i++)
        cin>>a[i]>>b[i];
    for(int i=0 ; i<n ; i++)
        for(int j=i+1 ; j<n ; j++)
            ans=min(ans , max(abs(a[i]-a[j]) , abs(b[i]-b[j])) * max(abs(a[i]-a[j]) , abs(b[i]-b[j])));
    cout<<ans;
    return 0;
}


//IN THE NAME OF GOD\\
//Ready To Enter Div 1!

#include <bits/stdc++.h>

#define pb push_back
#define left(x) ((x)*(2))
#define right(x) (((x)*(2))+1)
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair <int , int> pii;
typedef pair <pii , int> ppii;
typedef pair <int , pii> pipi;
typedef pair <ll , ll> pll;

const int maxn = 2e5+10 , Msk = (1<<17) , inf = 1e9+10 , MOD = 1e9+7 , Sq = 708;
const ll INF=1e18+10;

int main(){
    ios_base::sync_with_stdio(false);
    int mnx=inf,mxx=0,mny=inf,mxy=0 , n;
    cin>>n;
    for(int i=0,x,y ; i<n ; i++){
        cin>>x>>y;
        mnx=min(mnx , x);
        mxx=max(mxx , x);
        mny=min(mny , y);
        mxy=max(mxy , y);
    }
    cout<<(max(mxy , mxx)-min(mny , mnx))*(max(mxy , mxx)-min(mny , mnx));
    return 0;
}


//IN THE NAME OF GOD\\
//Ready To Enter Div 1!

#include <bits/stdc++.h>

#define pb push_back
#define left(x) ((x)*(2))
#define right(x) (((x)*(2))+1)
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair <int , int> pii;
typedef pair <pii , int> ppii;
typedef pair <int , pii> pipi;
typedef pair <ll , ll> pll;

const int maxn = 2e5+10 , Msk = (1<<17) , inf = 1e9+10 , MOD = 1e9+7 , Sq = 708;
const ll INF=1e18+10;

int main(){
    ios_base::sync_with_stdio(false);
    ll mnx=inf,mxx=-inf,mny=inf,mxy=-inf , n;
    cin>>n;
    for(ll i=0,x,y ; i<n ; i++){
        cin>>x>>y;
        mnx=min(mnx , x);
        mxx=max(mxx , x);
        mny=min(mny , y);
        mxy=max(mxy , y);
    }
    cout<<max(mxx-mnx , mxy-mny)*max(mxx-mnx , mxy-mny);
    return 0;
}


//IN THE NAME OF GOD\\
//Ready To Enter Div 1!

#include <bits/stdc++.h>

#define pb push_back
#define left(x) ((x)*(2))
#define right(x) (((x)*(2))+1)
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair <int , int> pii;
typedef pair <pii , int> ppii;
typedef pair <int , pii> pipi;
typedef pair <ll , ll> pll;

const int maxn = 2e5+10 , Msk = (1<<17) , inf = 1e9+10 , MOD = 1e9+7 , Sq = 708;
const ll INF=1e18+10;

int main(){
    ios_base::sync_with_stdio(false);
    ll mnx=inf,mxx=0,mny=inf,mxy=0 , n;
    cin>>n;
    for(ll i=0,x,y ; i<n ; i++){
        cin>>x>>y;
        mnx=min(mnx , x);
        mxx=max(mxx , x);
        mny=min(mny , y);
        mxy=max(mxy , y);
    }
    cout<<max(mxx-mnx , mxy-mny)*max(mxx-mnx , mxy-mny);
    return 0;
}


//IN THE NAME OF GOD\\
//Ready To Enter Div 1!

#include <bits/stdc++.h>

#define pb push_back
#define left(x) ((x)*(2))
#define right(x) (((x)*(2))+1)
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair <int , int> pii;
typedef pair <pii , int> ppii;
typedef pair <int , pii> pipi;
typedef pair <ll , ll> pll;

const int maxn = 2e5+10 , Msk = (1<<17) , inf = 1e9+10 , MOD = 1e9+7 , Sq = 708;
const ll INF=1e18+10;

int main(){
    ios_base::sync_with_stdio(false);
    ll mnx=inf,mxx=0,mny=inf,mxy=0 , n;
    cin>>n;
    for(ll i=0,x,y ; i<n ; i++){
        cin>>x>>y;
        mnx=min(mnx , x);
        mxx=max(mxx , x);
        mny=min(mny , y);
        mxy=max(mxy , y);
    }
    cout<<(max(mxy , mxx)-min(mny , mnx))*(max(mxy , mxx)-min(mny , mnx));
    return 0;
}


//IN THE NAME OF GOD\\
//Ready To Enter Div 1!

#include <bits/stdc++.h>

#define pb push_back
#define left(x) ((x)*(2))
#define right(x) (((x)*(2))+1)
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef pair <int , int> pii;
typedef pair <pii , int> ppii;
typedef pair <int , pii> pipi;
typedef pair <ll , ll> pll;

const int maxn = 2e5+10 , Msk = (1<<17) , inf = 1e9+10 , MOD = 1e9+7 , Sq = 708;
const ll INF=1e18+10;

int main(){
    ios_base::sync_with_stdio(false);
    ll mnx=inf,mxx=0,mny=inf,mxy=0 , n;
    cin>>n;
    for(int i=0,x,y ; i<n ; i++){
        cin>>x>>y;
        mnx=min(mnx , x);
        mxx=max(mxx , x);
        mny=min(mny , y);
        mxy=max(mxy , y);
    }
    cout<<(max(mxy , mxx)-min(mny , mnx))*(max(mxy , mxx)-min(mny , mnx));
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int x[1000],y[1000];
int main()
{
    int n,i,j,ans=0;
    cin>>n;
    for(i=1;i<=n;++i)
        cin>>x[i]>>y[i];
    sort(x+1,x+n+1);
    sort(y+1,y+n+1);
    ans=(x[n]-x[1],y[n]-y[1]);
    cout<<ans*ans;
}


#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int x[1005],y[1005];
int main()
{
    int n,i,j,minx,miny,maxx,maxy;
    long long ans;
    cin>>n;
    for(i=1;i<=n;++i)
        cin>>x[i]>>y[i];
    minx=x[1];
    maxx=x[1];
    miny=y[1];
    maxy=y[1];
    for(i=1;i<=n;++i)
    {
        if(x[i]>maxx)
            maxx=x[i];
        if(x[i]<minx)
            minx=x[i];
        if(y[i]>maxy)
            maxy=y[i];
        if(y[i]<miny)
            miny=y[i];
    }
    ans=max(maxx-minx,maxy-miny);
    cout<<ans*ans;
}


#include<iostream>
#include<algorithm>
using namespace std;
int x[1005],y[1005];
int main()
{
    int n,i,j;
    long long ans;
    cin>>n;
    for(i=1;i<=n;++i)
        cin>>x[i]>>y[i];
    sort(x+1,x+n+1);
    sort(y+1,y+n+1);
    ans=(x[n]-x[1],y[n]-y[1]);
    ans*=ans;
    cout<<ans;
}


#include<iostream>
#include<algorithm>
using namespace std;
int x[1000],y[1000];
int main()
{
    int n,i,j;
    long long ans;
    cin>>n;
    for(i=1;i<=n;++i)
        cin>>x[i]>>y[i];
    sort(x+1,x+n+1);
    sort(y+1,y+n+1);
    ans=(x[n]-x[1],y[n]-y[1]);
    cout<<ans*ans;
}


#include<bits/stdc++.h>
#define   ll    long long int
#define   sz    200010
#define   md    10098213

using namespace std;

int main()
{

    ll n,k,i,j,a,p,m,x1,x2,y,x,y1,y2;

    x1=y1=10000000000;
    x2=y2=0;

    cin>>n;

    while(n--)
    {
            cin>>x>>y;

            x1=min(x1,x);
            x2=max(x2,x);

            y1=min(y1,y);
            y2=max(y2,y);
    }

    x=x2-x1;
    y=y2-y1;

    x=max(x,y);

    cout<<x*x<<endl;

    return 0;
}


#include<bits/stdc++.h>
#define   ll    long long int
#define   sz    200010
#define   md    10098213

using namespace std;

int main()
{

    ll n,k,i,j,a,p,m,x1,x2,y,x,y1,y2;

    x1=x2=y1=y2=0;

    cin>>n;

    while(n--)
    {
        cin>>x>>y;
        if(x<0)
        {
            x=-1*x;
            x1=max(x1,x);
        }
        else
        {
            x2=max(x2,x);
        }

        if(y<0)
        {
            y=-1*y;
            y1=max(y1,y);
        }
        else
        {
            y2=max(y2,y);
        }

    }
    x=x1+x2;
    y=y1+y2;

    if(x==0)x=y;
    else if(y==0)y=x;

    cout<<x*y<<endl;

    return 0;
}


#include<bits/stdc++.h>
#define   ll    long long int
#define   sz    200010
#define   md    10098213

using namespace std;

int main()
{

    ll n,k,i,j,a,p,m,x1,x2,y,x,y1,y2;

    x1=y1=10000000000;
    x2=y2=-10000000000;

    cin>>n;

    while(n--)
    {
            cin>>x>>y;

            x1=min(x1,x);
            x2=max(x2,x);

            y1=min(y1,y);
            y2=max(y2,y);
    }

    x=x2-x1;
    y=y2-y1;

    x=max(x,y);

    cout<<x*x<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct node
{
	long long a,b;
}mm[10005];
int cmp(node m,node n)
{
	if(m.a==n.a) return m.b<n.b;
	else return m.a<n.a;
}
int main()
{
    int n;
    scanf("%d",&n);
    long long MAX=0;
    for(int i=0;i<n;i++)
    {
    	scanf("%I64d%I64d",&mm[i].a,&mm[i].b);
	}
	sort(mm,mm+n,cmp);
	MAX=max(fabs(mm[n-1].a-mm[0].a),fabs(mm[0].b-mm[n-1].b));
	MAX=MAX*MAX;
	printf("%I64d\n",MAX);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct node
{
	int a,b;
}map1[10005];
int cmp(node m,node n)
{
	if(m.a==n.a) return m.b<n.b;
	else return m.a<n.a;
}
int main()
{
    int n;
    scanf("%d",&n);
    long long MAX=0;
    for(int i=0;i<n;i++)
    {
    	scanf("%d%d",&map1[i].a,&map1[i].b);
	}
	sort(map1,map1+n,cmp);
	MAX=(map1[n-1].a-map1[0].a)*(map1[n-1].b-map1[0].b);
	printf("%I64d\n",MAX);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct node
{
	int a,b;
}map1[10005];
int cmp(node m,node n)
{
	if(m.a==n.a) return m.b<n.b;
	else return m.a<n.a;
}
int main()
{
    int n;
    scanf("%d",&n);
    long long MAX=0;
    for(int i=0;i<n;i++)
    {
    	scanf("%d%d",&map1[i].a,&map1[i].b);
	}
	sort(map1,map1+n,cmp);
	MAX=max((map1[n-1].a-map1[0].a),(map1[n-1].b-map1[0].b));
	MAX*=MAX;
	printf("%I64d\n",MAX);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    long long MAX=0;
    long long x1=1e10,x2=-1e10,y1=1e10,y2=-1e10;
    for(int i=0;i<n;i++)
    {
    	long long a,b;
    	scanf("%I64d%I64d",&a,&b);
    	x1=min(x1,a);x2=max(x2,a);
    	y1=min(y1,a);y2=max(y2,a);
	}

	MAX=max(fabs(x2-x1),fabs(y2-y1));
	MAX=MAX*MAX;
	printf("%I64d\n",MAX);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct node
{
	long long a,b;
}mm[10005];
int cmp(node m,node n)
{
	if(m.a==n.a) return m.b<n.b;
	else return m.a<n.a;
}
int main()
{
    int n;
    scanf("%d",&n);
    long long MAX=0;
    for(int i=0;i<n;i++)
    {
    	scanf("%I64d%I64d",&mm[i].a,&mm[i].b);
	}
	sort(mm,mm+n,cmp);
	MAX=max((mm[n-1].a-mm[0].a),(mm[0].b-mm[n-1].b));
	MAX=MAX*MAX;
	printf("%I64d\n",MAX);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    long long MAX=0;
    long long x1=1e10,x2=-1e10,y1=1e10,y2=-1e10;
    for(int i=0;i<n;i++)
    {
    	long long a,b;
    	scanf("%I64d%I64d",&a,&b);
    	x1=min(x1,a);x2=max(x2,a);
    	y1=min(y1,b);y2=max(y2,b);
	}
	//printf("%I64d %I64d %I64d %I64d\n",x1,x2,y1,y2);
	MAX=max(fabs(x2-x1),fabs(y2-y1));
	MAX=MAX*MAX;
	printf("%I64d\n",MAX);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct node
{
	long long a,b;
}mm[10005];
int cmp(node m,node n)
{
	if(m.a==n.a) return m.b<n.b;
	else return m.a<n.a;
}
int main()
{
    int n;
    scanf("%d",&n);
    long long MAX=0;
    for(int i=0;i<n;i++)
    {
    	scanf("%I64d%I64d",&mm[i].a,&mm[i].b);
	}
	sort(mm,mm+n,cmp);
	MAX=max((mm[n-1].a-mm[0].a),(mm[n-1].b-mm[0].b));
	MAX=MAX*MAX;
	printf("%I64d\n",MAX);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    long long MAX=0;
    while(n--)
    {
    	int a,b;
    	scanf("%d%d",&a,&b);
    	MAX=max(MAX,a);
    	MAX=max(MAX,b);
	}
	MAX*=MAX;
	printf("%I64d\n",MAX);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    long long MAX=0;
    long long x1=1e10,x2=-1e10,y1=1e10,y2=-1e10;
    for(int i=0;i<n;i++)
    {
    	long long a,b;
    	scanf("%I64d%I64d",&a,&b);
    	x1=min(x1,a);x2=max(x2,a);
    	y1=min(y1,a);y2=max(y2,a);
	}

	MAX=max(fabs(y1-x1),fabs(y2-x2));
	MAX=MAX*MAX;
	printf("%I64d\n",MAX);
    return 0;
}


/*NAME: SANYAM GARG
INSTITUTION:DELHI TECHNOLOGICAL UNIVERSITY*/
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset>
#define mod 1000000007
#define li long long int
#define ll int
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s",&x)
#define readl(x) scanf("%I64d",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 2000000000000000000
using namespace std;
int main()
{
	li n,valx,valy,valx2,valy2,i;
	cin>>n;
	li x[n],y[n];
	for(i=0;i<n;i++)
	{
		cin>>x[i]>>y[i];
	}
	valx=INT_MAX;
		valy=INT_MAX;
		valx2=INT_MIN;
		valy2=INT_MIN;
	for(i=0;i<n;i++)
	{
		valx=min(valx,x[i]);
		valy=min(valy,y[i]);
			valx2=max(valx2,x[i]);
		valy2=max(valy2,y[i]);
	}
	if((valy2-valy)>=(valx2-valx))
	{
		cout<<(valy2-valy)*(valy2-valy);
	}
	else if((valy2-valy)<(valx2-valx))
	{
		cout<<(valx2-valx)*(valx2-valx);
	}

}


/*NAME: SANYAM GARG
INSTITUTION:DELHI TECHNOLOGICAL UNIVERSITY*/
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset>
#define mod 1000000007
#define li long long int
#define ll int
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s",&x)
#define readl(x) scanf("%I64d",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 2000000000000000000
using namespace std;
int main()
{
	li n,valx,valy,valx2,valy2,i;
	cin>>n;
	li x[n],y[n];
	for(i=0;i<n;i++)
	{
		cin>>x[i]>>y[i];
	}
	valx=INT_MAX;
		valy=INT_MAX;
		valx2=INT_MIN;
		valy2=INT_MIN;
	for(i=0;i<n;i++)
	{
		valx=min(valx,x[i]);
		valy=min(valy,y[i]);
			valx2=max(valx2,x[i]);
		valy2=max(valy2,y[i]);
	}
	if(valy2==valy)
	{
		valy2=valx2;
		valy=valx;
	}
	else if(valx2==valx)
	{
		valx2=valy2;
		valx=valy;
	}
	cout<<(valy2-valy)*(valx2-valx);

}


/*NAME: SANYAM GARG
INSTITUTION:DELHI TECHNOLOGICAL UNIVERSITY*/
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset>
#define mod 1000000007
#define li long long int
#define ll int
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s",&x)
#define readl(x) scanf("%I64d",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 2000000000000000000
using namespace std;
int main()
{
	li n,valx,valy,valx2,valy2,i;
	cin>>n;
	li x[n],y[n];
	for(i=0;i<n;i++)
	{
		cin>>x[i]>>y[i];
	}
	valx=INT_MAX;
		valy=INT_MAX;
		valx2=INT_MIN;
		valy2=INT_MIN;
	for(i=0;i<n;i++)
	{
		valx=min(valx,x[i]);
		valy=min(valy,y[i]);
			valx2=max(valx2,x[i]);
		valy2=max(valy2,y[i]);
	}
	if((valy2-valy)>=(valx2-valx))
	{
		cout<<(valy2-valy)*(valy2-valy);
	}
	else if((valy2-valy)<(valx2-valx))
	{
		cout<<(valx2-valx)*(valy2-valy);
	}
;

}


/*NAME: SANYAM GARG
INSTITUTION:DELHI TECHNOLOGICAL UNIVERSITY*/
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset>
#define mod 1000000007
#define li long long int
#define ll int
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s",&x)
#define readl(x) scanf("%I64d",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 2000000000000000000
using namespace std;
int main()
{
	li n,valx,valy,valx2,valy2,i;
	cin>>n;
	li x[n],y[n];
	for(i=0;i<n;i++)
	{
		cin>>x[i]>>y[i];
	}
	valx=INT_MAX;
		valy=INT_MAX;
		valx2=INT_MIN;
		valy2=INT_MIN;
	for(i=0;i<n;i++)
	{
		valx=min(valx,x[i]);
		valy=min(valy,y[i]);
			valx2=max(valx2,x[i]);
		valy2=max(valy2,y[i]);
	}
    valx2=max(valx2,valy2);
    valx=min(valx,valy);
	cout<<(valx2-valx)*(valx2-valx);

}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
    //freopen ("input.txt", "r", stdin);
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    x1 = max (coo[n].F, alt[n].F);
    y1 = max (coo[n].S, alt[n].S);
    x2 = min (coo[1].F, alt[1].F);
    y2 = min (coo[1].S, coo[1].S);
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
    //freopen ("input.txt", "r", stdin);
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    if (coo[n].F > alt[n].F && coo[n].S > alt[n].S){
        x1 = coo[n].F;
        y1 = coo[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S < alt[n].S){
        x1 = alt[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F > alt[n].F && coo[n].S < alt[n].S){
        x1 = coo[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S > alt[n].S){
        x1 = alt[n].F;
        y1 = coo[n].S;
    }
    if (coo[1].F > alt[1].F && coo[1].S > alt[1].S){
        x2 = alt[1].F;
        y2 = alt[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S < alt[1].S){
        x2 = coo[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F > alt[1].F && coo[1].S < alt[1].S){
        x2 = alt[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S > alt[1].S){
        x2 = coo[1].F;
        y2 = alt[1].S;
    }
    if (coo[1].F == alt[1].F){
        x2 = coo[1].F;
    }
    if (coo[n].F == alt[n].F){
        x1 = coo[n].F;
    }
    if (coo[1].S == alt[1].S){
        y2 = coo[1].S;
    }
    if (coo[n].S == alt[n].S){
        y1 = coo[n].S;
    }
    //cout << x1 << " " << y1 << " " << x2 << " " << y2 << "\n";
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
    freopen ("input.txt", "r", stdin);
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    x1 = max (coo[n].F, alt[n].F);
    x2 = min (coo[1].F, alt[1].F);
    y1 = -INF;
    y2 = INF;
    for(int i = 1; i <= n; i++) {
        y1 = max(y1, coo[i].S);
        y2 = min(y2, coo[i].S);
    }
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
  //  freopen ("input.txt", "r", stdin);
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    x1 = coo[n].F;
    x2 = coo[1].F;
    y1 = -INF;
    y2 = INF;
    for(int i = 1; i <= n; i++) {
        y1 = max(y1, coo[i].S);
        y2 = min(y2, coo[i].S);
    }
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
    //freopen ("input.txt", "r", stdin);
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    x1 = max (abs (coo[n].F), abs (alt[n].F));
    y1 = max (abs (coo[n].S), abs (alt[n].S));
    x2 = min (coo[1].F, alt[1].F);
    y2 = min (coo[1].S, coo[1].S);
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
    //freopen ("input.txt", "r", stdin);
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    x1 = max (coo[n].F, alt[n].F);
    x2 = min (coo[1].F, alt[1].F);
    y1 = -INF;
    y2 = INF;
    for(int i = 1; i <= n; i++) {
        y1 = max(y1, coo[i].S);
        y2 = min(y2, coo[i].S);
    }
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MIN], alt[MIN];

int main(){
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    if (coo[n].F >= alt[n].F && coo[n].S >= alt[n].S){
        x1 = coo[n].F;
        y1 = coo[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S < alt[n].S){
        x1 = alt[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F >= alt[n].F && coo[n].S < alt[n].S){
        x1 = coo[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S >= alt[n].S){
        x1 = alt[n].F;
        y1 = coo[n].S;
    }
    if (coo[1].F >= alt[1].F && coo[1].S >= alt[1].S){
        x2 = alt[1].F;
        y2 = alt[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S < alt[1].S){
        x2 = coo[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F >= alt[1].F && coo[1].S < alt[1].S){
        x2 = alt[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S >= alt[1].S){
        x2 = coo[1].F;
        y2 = alt[1].S;
    }
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MIN], alt[MIN];

int main(){
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    if (coo[n].F >= alt[n].F && coo[n].S >= alt[n].S){
        x1 = coo[n].F;
        y1 = coo[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S < alt[n].S){
        x1 = alt[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F >= alt[n].F && coo[n].S < alt[n].S){
        x1 = coo[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S >= alt[n].S){
        x1 = alt[n].F;
        y1 = coo[n].S;
    }
    if (coo[1].F >= alt[1].F && coo[1].S >= alt[1].S){
        x2 = alt[1].F;
        y2 = alt[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S < alt[1].S){
        x2 = coo[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F >= alt[1].F && coo[1].S < alt[1].S){
        x2 = alt[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S >= alt[1].S){
        x2 = coo[1].F;
        y2 = alt[1].S;
    }
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    if (coo[n].F > alt[n].F && coo[n].S > alt[n].S){
        x1 = coo[n].F;
        y1 = coo[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S < alt[n].S){
        x1 = alt[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F > alt[n].F && coo[n].S < alt[n].S){
        x1 = coo[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S > alt[n].S){
        x1 = alt[n].F;
        y1 = coo[n].S;
    }
    if (coo[1].F > alt[1].F && coo[1].S > alt[1].S){
        x2 = alt[1].F;
        y2 = alt[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S < alt[1].S){
        x2 = coo[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F > alt[1].F && coo[1].S < alt[1].S){
        x2 = alt[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S > alt[1].S){
        x2 = coo[1].F;
        y2 = alt[1].S;
    }
    if (coo[1].F == alt[1].F){
        x2 = coo[1].F;
    }
    if (coo[n].F == alt[n].F){
        x1 = coo[1].F;
    }
    if (coo[1].S == alt[1].S){
        y2 = coo[1].S;
    }
    if (coo[n].S == alt[n].S){
        y1 = coo[n].S;
    }
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
    //freopen ("input.txt", "r", stdin);
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    x1 = max (coo[n].F, alt[n].S);
    x2 = min (coo[1].F, alt[1].S);
    y1 = -INF;
    y2 = INF;
    for(int i = 1; i <= n; i++) {
        y1 = max(y1, coo[i].S);
        y2 = min(y2, coo[i].S);
    }
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    if (coo[n].F >= alt[n].F && coo[n].S >= alt[n].S){
        x1 = coo[n].F;
        y1 = coo[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S < alt[n].S){
        x1 = alt[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F >= alt[n].F && coo[n].S < alt[n].S){
        x1 = coo[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S >= alt[n].S){
        x1 = alt[n].F;
        y1 = coo[n].S;
    }
    if (coo[1].F >= alt[1].F && coo[1].S >= alt[1].S){
        x2 = alt[1].F;
        y2 = alt[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S < alt[1].S){
        x2 = coo[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F >= alt[1].F && coo[1].S < alt[1].S){
        x2 = alt[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S >= alt[1].S){
        x2 = coo[1].F;
        y2 = alt[1].S;
    }
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    if (coo[n].F >= alt[n].F && coo[n].S >= alt[n].S){
        x1 = coo[n].F;
        y1 = coo[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S < alt[n].S){
        x1 = alt[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F > alt[n].F && coo[n].S < alt[n].S){
        x1 = coo[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F <= alt[n].F && coo[n].S >= alt[n].S){
        x1 = alt[n].F;
        y1 = coo[n].S;
    }
    if (coo[1].F >= alt[1].F && coo[1].S >= alt[1].S){
        x2 = alt[1].F;
        y2 = alt[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S < alt[1].S){
        x2 = coo[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F >= alt[1].F && coo[1].S <= alt[1].S){
        x2 = alt[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S > alt[1].S){
        x2 = coo[1].F;
        y2 = alt[1].S;
    }
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
    freopen ("input.txt", "r", stdin);
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort (coo + 1, coo + n + 1);
    sort (alt + 1, alt + n + 1);
    if (coo[n].F > alt[n].F && coo[n].S > alt[n].S){
        x1 = coo[n].F;
        y1 = coo[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S < alt[n].S){
        x1 = alt[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F > alt[n].F && coo[n].S < alt[n].S){
        x1 = coo[n].F;
        y1 = alt[n].S;
    }
    else if (coo[n].F < alt[n].F && coo[n].S > alt[n].S){
        x1 = alt[n].F;
        y1 = coo[n].S;
    }
    if (coo[1].F > alt[1].F && coo[1].S > alt[1].S){
        x2 = alt[1].F;
        y2 = alt[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S < alt[1].S){
        x2 = coo[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F > alt[1].F && coo[1].S < alt[1].S){
        x2 = alt[1].F;
        y2 = coo[1].S;
    }
    else if (coo[1].F < alt[1].F && coo[1].S > alt[1].S){
        x2 = coo[1].F;
        y2 = alt[1].S;
    }
    if (coo[1].F == alt[1].F){
        x2 = coo[1].F;
    }
    if (coo[n].F == alt[n].F){
        x1 = coo[n].F;
    }
    if (coo[1].S == alt[1].S){
        y2 = coo[1].S;
    }
    if (coo[n].S == alt[n].S){
        y1 = coo[n].S;
    }
    cout << x1 << " " << y1 << " " << x2 << " " << y2 << "\n";
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned ll
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define y1 EASY_ACCEPTED
#define exp EASY_FULL

using namespace std;

const int MIN = 1e3 + 2;
const int MXN = 1e5 + 3;
const int INF = 1e9 + 7;
const ll LINF = 1e18 + 15;
const double EPS = 1e-9;

ll n, x1, y1, x2, y2;
pair <ll, ll> coo[MXN], alt[MXN];

int main(){
 //   freopen ("input.txt", "r", stdin);
    cin >> n;
    for (ll i = 1; i <= n; i++){
        cin >> coo[i].F >> coo[i].S;
        alt[i].S = coo[i].F;
        alt[i].F = coo[i].S;
    }
    sort(coo+1,coo+1+n);
    x1 = coo[n].F;
    x2 = coo[1].F;
    y1 = -INF;
    y2 = INF;
    for(int i = 1; i <= n; i++) {
        y1 = max(y1, coo[i].S);
        y2 = min(y2, coo[i].S);
    }
    cout << max ((x2 - x1) * (x2 - x1), (y2 - y1) * (y2 - y1));
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main() {
    int n, x, y, minx, miny, maxx, maxy;

    cin >> n;

    minx = miny = (1 << 30);
    maxx = maxy = -(1 << 30);
    for (int i = 1; i <= n; i++) {
        cin >> x >> y;
        minx = min(minx, x);
        miny = min(miny, y);
        maxx = max(maxx, x);
        maxy = max(maxy, y);
    }

    int sz = max(maxx - minx, maxy - miny);

    long long A = (long long) sz * sz;
    cout << A << endl;
}


#include<bits/stdc++.h>
using namespace std;

int main() {
    int n, x, y, minx, miny, maxx, maxy;

    cin >> n;

    minx = miny = (1 << 30);
    maxx = maxy = -(1 << 30);
    for (int i = 1; i <= n; i++) {
        cin >> x >> y;
        minx = min(minx, x);
        miny = min(miny, y);
        maxx = max(maxx, x);
        maxy = max(maxy, y);
    }

    int sz = max(maxx - minx, maxy - miny);

    long long A = (LL) sz * sz;
    cout << A << endl;
}


#include<bits/stdc++.h>
using namespace std;

int main() {
    int n, x, y, minx, miny, maxx, maxy;

    cin >> n;

    minx = miny = (1 << 30);
    maxx = maxy = -(1 << 30);
    for (int i = 1; i <= n; i++) {
        cin >> x >> y;
        minx = min(minx, x);
        miny = min(miny, y);
        maxx = max(maxx, x);
        maxy = max(maxy, y);
    }

    int sz = max(maxx - minx, maxy - miny);
    cout << sz * sz << endl;
}


#include<bits/stdc++.h>
using namespace std;

int main() {
    int n, x, y, minx, miny, maxx, maxy;

    cin >> n;

    minx = miny = (1 << 30);
    maxx = maxy = -(1 << 30);
    for (int i = 1; i <= n; i++) {
        cin >> x >> y;
        minx = min(minx, x);
        miny = min(miny, y);
        maxx = max(maxx, x);
        maxy = max(maxy, y);
    }

    int sz = max(maxx - minx, maxy - miny);

    LL A = (LL) sz * sz;
    cout << A << endl;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    int n,x,y;
    int mnx = 1 << 30,mny = 1 << 30,mxy = -1*1<<30,mxx=-1 * 1<<30;
    scanf("%d",&n);
    for (int i = 0 ; i < n ; i++)
    {
        scanf("%d%d",&x,&y);
        mnx = min(mnx,x);
        mny = min(mny,y);
        mxx = max(mxx,x);
        mxy = max(mxx,y);
    }
    int a = max(max(1,mxx-mnx),mxy-mny);
    cout << a * a << endl;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    int n;
    long long x,y;
    long long mnx,mny,mxy,mxx;
    scanf("%d",&n);
    cin >> x >> y;
    mxx = mnx = x;
    mnx = mny = y;
    for (int i = 1 ; i < n ; i++)
    {
        cin >> x >> y;
        mnx = min(mnx,x);
        mny = min(mny,y);
        mxx = max(mxx,x);
        mxy = max(mxx,y);
    }
    cout<<max((mxx-mnx),(mxy-mny))*max((mxx-mnx),(mxy-mny));
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    int n;
    long long x,y;
    long long mnx = 1 << 30,mny = 1 << 30,mxy = -1*1<<30,mxx=-1 * 1<<30;
    scanf("%d",&n);
    for (int i = 0 ; i < n ; i++)
    {
        cin >> x >> y;
        mnx = min(mnx,x);
        mny = min(mny,y);
        mxx = max(mxx,x);
        mxy = max(mxx,y);
    }
    long long a = 1;
    if (mxx-mnx > a)
        a = mxx-mnx;
    if (mxy-mny > a)
        a = mxy-mny;
    cout << (long long)a*a << endl;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    int n;
    long long x,y;
    long long mnx = 1 << 30,mny = 1 << 30,mxy = -1*1<<30,mxx=-1 * 1<<30;
    scanf("%d",&n);
    for (int i = 0 ; i < n ; i++)
    {
        cin >> x >> y;
        mnx = min(mnx,x);
        mny = min(mny,y);
        mxx = max(mxx,x);
        mxy = max(mxy,y);
    }
    cout<<max((mxx-mnx),(mxy-mny))*max((mxx-mnx),(mxy-mny));
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    int n;
    long long x,y;
    long long mnx = 1 << 30,mny = 1 << 30,mxy = -1*1<<30,mxx=-1 * 1<<30;
    scanf("%d",&n);
    for (int i = 0 ; i < n ; i++)
    {
        cin >> x >> y;
        mnx = min(mnx,x);
        mny = min(mny,y);
        mxx = max(mxx,x);
        mxy = max(mxx,y);
    }
    cout<<max((mxx-mnx),(mxy-mny))*max((mxx-mnx),(mxy-mny));
}


#include<bits/stdc++.h>
using namespace std;

int main()
{ int n,i;
  cin>>n;

  long long int miny=1000000000000000,maxy=(-100000000000),minx=1000000000000000,maxx=(-100000000000;

  for(i=0;i<n;i++)
  {int a,b;
   cin>a>>b;

   if(a>maxx)
   {maxx=a;}
   else if(a<minx)
   {minx=a;}

   if(b>maxy)
   {maxy=b;}
   else if(b<miny)
   {miny=b;}
  }

  long long int k=max(xmax-xmin,ymax-ymin);

  cout<<k*k;

  return 0;}


#include<bits/stdc++.h>
using namespace std;

int main()
{ int n,i;
  cin>>n;

  long long int miny=1000000000000000,maxy=(-100000000000),minx=1000000000000000,maxx=(-100000000000);

  for(i=0;i<n;i++)
  {int a,b;
   cin>>a>>b;

   if(a>maxx)
   {maxx=a;}
    if(a<minx)
   {minx=a;}

   if(b>maxy)
   {maxy=b;}
   if(b<miny)
   {miny=b;}
  }

  long long int k=max(maxx-minx,maxy-miny);

  cout<<k*k;

  return 0;}


#include<bits/stdc++.h>
using namespace std;

int main()
{ int n,i;
  cin>>n;

  long long int miny=1000000000000000,maxy=(-100000000000),minx=1000000000000000,maxx=(-100000000000);

  for(i=0;i<n;i++)
  {int a,b;
   cin>a>>b;

   if(a>maxx)
   {maxx=a;}
   else if(a<minx)
   {minx=a;}

   if(b>maxy)
   {maxy=b;}
   else if(b<miny)
   {miny=b;}
  }

  long long int k=max(xmax-xmin,ymax-ymin);

  cout<<k*k;

  return 0;}


#include<bits/stdc++.h>
using namespace std;

int main()
{ int n,i;
  cin>>n;

  long long int miny=1000000000000000,maxy=(-100000000000),minx=1000000000000000,maxx=(-100000000000);

  for(i=0;i<n;i++)
  {int a,b;
   cin>>a>>b;

   if(a>maxx)
   {maxx=a;}
   else if(a<minx)
   {minx=a;}

   if(b>maxy)
   {maxy=b;}
   else if(b<miny)
   {miny=b;}
  }

  long long int k=max(xmax-xmin,ymax-ymin);

  cout<<k*k;

  return 0;}


# include <bits/stdc++.h>

using namespace std;

# define ll long long
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second
# define fo(i, n) for(int i = 1;i <= n;i++)
# define time ios_base::sync_with_stdio(0);
//10-63-C8-89-5E-CF lucksettwice
//AC-81-12-0D-3D-3E
const ll N = 1e6 + 10;
const ll INF = 1e18;
const ll inf = -1e18;
const ll MOD = 1e9 + 7;

ll binpow (ll a, ll n)
{
    if (n == 0)
        return 1;
    if (n % 2 == 1)
        return binpow (a, n - 1) * a;
    else
    {
        ll b = binpow(a, n / 2);
        return b * b;
    }
}

ll n, x[N], y[N], mnx, mny, mxx, mxy;

int main()
{
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> x[i] >> y[i];
        mxy = max(mxy, y[i]);
        mxx = max(mxx, x[i]);
        mny = min(mny, y[i]);
        mnx = min(mnx, x[i]);
    }
    cout << max((mxy - mny), (mxx - mnx)) * max((mxy - mny), (mxx - mnx));
}
/**
1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 8 1 1 1 1 1 1
xabcab
**/


# include <bits/stdc++.h>

using namespace std;

# define ll long long
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second
# define fo(i, n) for(int i = 1;i <= n;i++)
# define time ios_base::sync_with_stdio(0);
//10-63-C8-89-5E-CF lucksettwice
//AC-81-12-0D-3D-3E
const ll N = 1e6 + 10;
const ll INF = 1e18;
const ll inf = -1e18;
const ll MOD = 1e9 + 7;

ll binpow (ll a, ll n)
{
    if (n == 0)
        return 1;
    if (n % 2 == 1)
        return binpow (a, n - 1) * a;
    else
    {
        ll b = binpow(a, n / 2);
        return b * b;
    }
}

ll n, x[N], y[N], mnx, mny, mxx, mxy;

int main()
{
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> x[i] >> y[i];
        mxy = max(mxy, y[i]);
        mxx = max(mxx, x[i]);
        mny = min(mny, y[i]);
        mnx = min(mnx, x[i]);
    }
    cout << (mxy - mny) * (mxx - mnx);
}
/**
1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 8 1 1 1 1 1 1
xabcab
**/


# include <bits/stdc++.h>

using namespace std;

# define ll long long
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second
# define fo(i, n) for(int i = 1;i <= n;i++)
# define time ios_base::sync_with_stdio(0);

const ll N = 1e6 + 10;
const ll INF = 1e18;
const ll inf = -1e18;
const ll MOD = 1e9 + 7;

ll binpow (ll a, ll n)
{
    if (n == 0)
        return 1;
    if (n % 2 == 1)
        return binpow (a, n - 1) * a;
    else
    {
        ll b = binpow(a, n / 2);
        return b * b;
    }
}

ll n, x[N], y[N], mnx = INF, mny = INF, mxx = inf, mxy = inf;

int main()
{
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> x[i] >> y[i];
        mxy = max(mxy, y[i]);
        mxx = max(mxx, x[i]);
        mny = min(mny, y[i]);
        mnx = min(mnx, x[i]);
    }
    cout << max((mxy - mny), (mxx - mnx)) * max((mxy - mny), (mxx - mnx));
}
/**
3
2 2
1 1
3 3
**/


#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

int main() {

    int n, floorcount;
    cin>>n>>floorcount;

    map<int,int> floortime;
    vector<int> floors;
    int time = 0;
    for(int i = 0; i < n; i++){
        int temp, temp2;
        cin>>temp>>temp2;
        floortime.insert(pair<int,int>(temp, temp2));
        floors.push_back(temp);
    }

    for(int i = n; i >= 0; i--){

        long pos = find(floors.begin(), floors.end(), i) - floors.begin();
        if(pos < floors.size()){
            if(time < floortime[floors[pos]]){
                time += floortime[floors[pos]] - time;
            }
        }

        time++;
    }

    cout<<time-1;

    return 0;
}


//
//  main.cpp
//  485B codeforces
//
//  Created by Zhi Wei Gan on 18/02/2016.
//  Copyright © 2016 Zhi Wei Gan. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...

    int n;
    cin>>n;

    vector<int> minesX;
    vector<int> minesY;

    for(int i = 0; i < n; i++){
        int x, y;
        cin>>x>>y;
        minesX.push_back(x);
        minesY.push_back(y);
    }
    int minxDist = *max_element(minesX.begin(), minesX.end()) - *min_element(minesX.begin(), minesX.end());
    int minyDist = *max_element(minesY.begin(), minesY.end()) - *min_element(minesY.begin(), minesY.end());

    cout<<pow(max(minxDist,minyDist),2);

    return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main() {

    int n;
    cin>>n;

    vector<int> minesX;
    vector<int> minesY;

    for(int i = 0; i < n; i++){
        int x, y;
        cin>>x>>y;
        minesX.push_back(x);
        minesY.push_back(y);
    }
    int minxDist = *max_element(minesX.begin(), minesX.end()) - *min_element(minesX.begin(), minesX.end());
    int minyDist = *max_element(minesY.begin(), minesY.end()) - *min_element(minesY.begin(), minesY.end());

    cout<<pow(max(minxDist,minyDist),2);

    return 0;
}


//
//  main.cpp
//  485B codeforces
//
//  Created by Zhi Wei Gan on 18/02/2016.
//  Copyright © 2016 Zhi Wei Gan. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...

    int n;
    cin>>n;

    vector<int> minesX;
    vector<int> minesY;

    for(int i = 0; i < n; i++){
        int x, y;
        cin>>x>>y;
        minesX.push_back(x);
        minesY.push_back(y);
    }
    int minxDist = *max_element(minesX.begin(), minesX.end()) - *min_element(minesX.begin(), minesX.end());
    int minyDist = *max_element(minesY.begin(), minesY.end()) - *min_element(minesY.begin(), minesY.end());

    cout<<pow(max(minxDist,minyDist),2);

    return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main() {

    int n;
    cin>>n;

    vector<int> minesX;
    vector<int> minesY;

    for(int i = 0; i < n; i++){
        int x, y;
        cin>>x>>y;
        minesX.push_back(x);
        minesY.push_back(y);
    }
    int minxDist = *max_element(minesX.begin(), minesX.end()) - *min_element(minesX.begin(), minesX.end());
    int minyDist = *max_element(minesY.begin(), minesY.end()) - *min_element(minesY.begin(), minesY.end());;

    cout<<pow(max(minxDist,minyDist),2);

    return 0;
}


//
//  main.cpp
//  485B codeforces
//
//  Created by Zhi Wei Gan on 18/02/2016.
//  Copyright © 2016 Zhi Wei Gan. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...

    int n;
    cin>>n;

    vector<int> minesX;
    vector<int> minesY;

    for(int i = 0; i < n; i++){
        int x, y;
        cin>>x>>y;
        minesX.push_back(x);
        minesY.push_back(y);
    }
    int minxDist = *max_element(minesX.begin(), minesX.end()) - *min_element(minesX.begin(), minesX.end());
    int minyDist = *max_element(minesY.begin(), minesY.end()) - *min_element(minesY.begin(), minesY.end());

    cout<<pow(max(minxDist,minyDist),2);

    return 0;
}


//
//  main.cpp
//  485B codeforces
//
//  Created by Zhi Wei Gan on 18/02/2016.
//  Copyright © 2016 Zhi Wei Gan. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...

    int n;
    cin>>n;

    vector<int> minesX;
    vector<int> minesY;

    for(int i = 0; i < n; i++){
        int x, y;
        cin>>x>>y;
        minesX.push_back(x);
        minesY.push_back(y);
    }
    unsigned long long minxDist = *max_element(minesX.begin(), minesX.end()) - *min_element(minesX.begin(), minesX.end());
    unsigned long long minyDist = *max_element(minesY.begin(), minesY.end()) - *min_element(minesY.begin(), minesY.end());
    unsigned long long ans = pow(max(minxDist,minyDist),2);

    cout<<ans;

    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define ll long long
#define mp make_pair
#define vip vector
#define ss second
#define ff first
#define pii pair<int,int>
#define pll pair<ll,ll>
#define M 1000000007
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
vector<string>v;
ll print(ll n)
{
    // Note that this loop runs till square root
    for (ll i=n/2; i>=1; i--)
    {
        if (n%i == 0)
        {
            return i;
        }
    }
    return n;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {cin>>a[i];}
    sort(a,a+n);
    ll c=1,d=1,p=0;
        for(ll i=0;i<n;i++)
        {
           if(d>=a[i])
           {c++;d=c;}
           else if(a[i]==a[i+1] && i<n-1)
           {
               c++;c+=p;d=c;p=0;
           }
           else
           {
              p++;
           }
        }
        cout<<d;
        cout<<"\n";
}
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define ll long long
#define mp make_pair
#define vip vector
#define ss second
#define ff first
#define pii pair<int,int>
#define pll pair<ll,ll>
#define M 1000000007
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
vector<string>v;
ll print(ll n)
{
    // Note that this loop runs till square root
    for (ll i=n/2; i>=1; i--)
    {
        if (n%i == 0)
        {
            return i;
        }
    }
    return n;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
    ll n;
    cin>>n;
    ll a[n];
    map<ll,ll>m;
    for(ll i=0;i<n;i++)
    {cin>>a[i];m[a[i]]++;}
    ll c=1,d=1,p=0;
       for(auto i:m)
       {
          if(d>=i.first)
          {
              c+=i.second;d=c;
          }
          else if(i.second>1)
          {
              c+=i.second+p;d=c;p=0;
          }
          else
          p++;
       }
       cout<<c;
        cout<<"\n";
}
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define ll long long
#define mp make_pair
#define vip vector
#define ss second
#define ff first
#define pii pair<int,int>
#define pll pair<ll,ll>
#define M 1000000007
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
vector<string>v;
ll print(ll n)
{
    // Note that this loop runs till square root
    for (ll i=n/2; i>=1; i--)
    {
        if (n%i == 0)
        {
            return i;
        }
    }
    return n;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
    ll n;
    cin>>n;
    ll a[n];
    map<ll,ll>m;
    for(ll i=0;i<n;i++)
    {cin>>a[i];m[a[i]]++;}
    ll c=1,d=1,p=0;
    sort(a,a+n);
    if(a[0]!=1)
    {cout<<"1\n";continue;}
    ll r=*max_element(a,a+n);
    if(r<=n)
    {cout<<n+1<<"\n";continue;}
       for(auto i:m)
       {
          if(d+i.second-1>=i.first)
          {
              d+=i.second;c=d;
          }
          else
        {
              d+=i.second;

       }
       }
       cout<<c;
        cout<<"\n";
}
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define ll long long
#define mp make_pair
#define vip vector
#define ss second
#define ff first
#define pii pair<int,int>
#define pll pair<ll,ll>
#define M 1000000007
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
vector<string>v;
ll print(ll n)
{
    // Note that this loop runs till square root
    for (ll i=n/2; i>=1; i--)
    {
        if (n%i == 0)
        {
            return i;
        }
    }
    return n;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {cin>>a[i];}
    sort(a,a+n);
    ll c=1,d=1,p=0;
        for(ll i=0;i<n;i++)
        {
           if(c>=a[i])
           {c++;d=c;}
           else
           {
              c++;
           }
        }
        cout<<d;
        cout<<"\n";
}
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define ll long long
#define mp make_pair
#define vip vector
#define ss second
#define ff first
#define pii pair<int,int>
#define pll pair<ll,ll>
#define M 1000000007
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
vector<string>v;
ll print(ll n)
{
    // Note that this loop runs till square root
    for (ll i=n/2; i>=1; i--)
    {
        if (n%i == 0)
        {
            return i;
        }
    }
    return n;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {cin>>a[i];}
    sort(a,a+n);
    if(a[0]!=1)
    cout<<"1\n";
    else
    {ll c=1,d=1,p=0;
        for(ll i=0;i<n;i++)
        {
           if(d>=a[i])
           {c++;d=c;}
           else if(a[i]==a[i+1])
           {
               c++;c+=p;d=c;p=0;
           }
           else
           {
              p++;
           }
        }
        cout<<c;
        cout<<"\n";
    }
}
}


#include<iostream>
#include<algorithm>

using namespace std;

const int N = 1e5 + 5;
int n, a[N];

void readInput() {
    cin >> n;
    for(int i = 0;i < n;i++) {
        cin >> a[i];
    }
}

void solve() {

    sort(a, a + n);

    int ans = 1;
    for(int i = 0;i < n;i++) {
        if(i + 1 >= a[i])
            ans = i + 2;
    }

    cout << ans << "\n";
}

int main() {

    int t;
    cin >> t;

    while(t --) {
        readInput();
        solve();
    }

    return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

const int N = 1e5 + 5;
int n, a[N];

void readInput() {
    cin >> n;
    for(int i = 0;i < n;i++) {
        cin >> a[i];
    }
}

void solve() {

    sort(a, a + n);

    int ans = 1;
    for(int i = 0;i < n;i++) {
        if(i >= a[i])
            ans = i + 2;
    }

    cout << ans << "\n";
}

int main() {

    int t;
    cin >> t;

    while(t --) {
        readInput();
        solve();
    }

    return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

const int N = 1e5 + 5;
const int VAL = 2e5 + 5;

int n;
int a[N], cnt[VAL];

void readInput() {
    cin >> n;

    int max_val = 0;
    for(int i = 0;i < n;i++) {
        cin >> a[i];
        max_val = max(a[i], max_val);
    }

    for(int i = 0;i <= max_val;i++)
        cnt[i] = 0;

    cnt[0] = 1;
    for(int i = 0;i < n;i++)
        cnt[a[i]] ++;

    for(int i = 1;i <= max_val;i++)
        cnt[i] += cnt[i - 1];
}

void solve() {
    sort(a, a + n);

    int ans = 1;
    for(int i = 0;i < n;i++) {
        if(cnt[a[i]] - 1 >= a[i])
            ans = cnt[a[i]];
    }

    cout << ans << "\n";
}

int main() {

    int t;
    cin >> t;

    while(t --) {
        readInput();
        solve();
    }

    return 0;
}


#include<iostream>
#include<algorithm>

using namespace std;

const int N = 1e5 + 5;
int n, a[N];

void readInput() {
    cin >> n;
    for(int i = 0;i < n;i++) {
        cin >> a[i];
    }
}

void solve() {

    sort(a, a + n);

    int ans = 1;
    for(int i = 0;i < n;i++) {
        if(i + 1 >= a[i])
            ans = i + 1;
    }

    cout << ans << "\n";
}

int main() {

    int t;
    cin >> t;

    while(t --) {
        readInput();
        solve();
    }

    return 0;
}


#include<iostream>

using namespace std;

const int N = 1e5 + 5;
const int VAL = 2e5 + 5;

int n;
int a[N], cnt[VAL];

void readInput() {
    cin >> n;

    int max_val = 0;
    for(int i = 0;i < n;i++) {
        cin >> a[i];
        max_val = max(a[i], max_val);
    }

    for(int i = 0;i <= max_val;i++)
        cnt[i] = 0;

    cnt[0] = 1;
    for(int i = 0;i < n;i++)
        cnt[a[i]] ++;

    for(int i = 1;i <= max_val;i++)
        cnt[i] += cnt[i - 1];
}

void solve() {
    sort(a, a + n);

    int ans = 1;
    for(int i = 0;i < n;i++) {
        if(cnt[a[i]] - 1 >= a[i])
            ans = cnt[a[i]];
    }

    cout << ans << "\n";
}

int main() {

    int t;
    cin >> t;

    while(t --) {
        readInput();
        solve();
    }

    return 0;
}


#include <cstdio>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    int TC;
    scanf("%d", &TC);
    while(TC--) {
        int N;
        scanf("%d", &N);
        vector<int> v(N);
        for(int i = 0; i < N; ++i)
            scanf("%d", &v[i]);

        vector<int> count(200001, 0);
        for(int i = 0; i < N; ++i)
            count[v[i]]++;

        set<int> s;
        vector<int> sorted_v;
        for(int i = 0; i < N; ++i) {
            if(s.find(v[i]) == s.end()) {
                sorted_v.push_back(v[i]);
                s.insert(v[i]);
            }
        }

        sort(sorted_v.begin(), sorted_v.end());

        int sum = 1;
        for(int i = 0; i < (int)sorted_v.size(); ) {
            if(sorted_v[i] <= sum + count[sorted_v[i]] - 1) {
                sum += count[sorted_v[i]];
                i++;
            } else {
                int cur = 0, j;
                for(j = i; j < (int)sorted_v.size(); ++j) {
                    cur += count[sorted_v[j]];
                    if(sorted_v[j] <= sum + cur - 1) {
                        sum += cur;
                        break;
                    }
                }
                i = j+1;
            }
        }

        printf("%d\n", sum);
    }
    return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int TC;
    scanf("%d", &TC);
    while(TC--) {
        int N;
        scanf("%d", &N);
        vector<int> v(N);
        for(int i = 0; i < N; ++i)
            scanf("%d", &v[i]);

        vector<int> count(200001, 0);
        for(int i = 0; i < N; ++i)
            count[v[i]]++;

        vector<int> sorted_v;
        vector<bool> check(200001, false);
        for(int i = 0; i < N; ++i) {
            if(!check[v[i]]) {
                sorted_v.push_back(v[i]);
                check[v[i]] = true;
            }
        }

        sort(sorted_v.begin(), sorted_v.end());

        int sum = 1;
        for(int i = 0; i < (int)sorted_v.size(); ) {
            if(sorted_v[i] <= sum + count[sorted_v[i]] - 1) {
                sum += count[sorted_v[i]];
                i++;
            } else {
                int cur = 0, j;
                for(j = i; j < (int)sorted_v.size(); ++j) {
                    cur += count[sorted_v[j]];
                    if(sorted_v[j] <= sum + cur - 1) {
                        sum += cur;
                        break;
                    }
                }
                i = j+1;
            }
        }

        printf("%d\n", sum);
    }
    return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int TC;
    scanf("%d", &TC);
    while(TC--) {
        int N;
        scanf("%d", &N);
        vector<int> v(N);
        for(int i = 0; i < N; ++i)
            scanf("%d", &v[i]);

        vector<int> count(200001, 0);
        vector<int> sorted_v;
        for(int i = 0; i < N; ++i) {
            if(count[v[i]] == 0) {
                count[v[i]]++;
                sorted_v.push_back(v[i]);
            } else {
                count[v[i]]++;
            }
        }

        sort(sorted_v.begin(), sorted_v.end());

        int sum = 1;
        for(int i = 0; i < (int)sorted_v.size(); ) {
            if(sorted_v[i] <= sum + count[sorted_v[i]] - 1) {
                sum += count[sorted_v[i]];
                i++;
            } else {
                int cur = 0, j;
                for(j = i; j < (int)sorted_v.size(); ++j) {
                    cur += count[sorted_v[j]];
                    if(sorted_v[j] <= sum + cur - 1) {
                        sum += cur;
                        break;
                    }
                }
                i = j+1;
            }
        }

        printf("%d\n", sum);
    }
    return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int TC;
    scanf("%d", &TC);
    while(TC--) {
        int N;
        scanf("%d", &N);
        vector<int> v(N);
        for(int i = 0; i < N; ++i)
            scanf("%d", &v[i]);

        sort(v.begin(), v.end());

        int i;
        for(i = N-1; i >= 0; --i) {
            if(v[i] <= i + 1) {
                printf("%d\n", i + 2);
                break;
            }
        }
        if(i < 0)
            printf("1\n");
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int TC;
    cin >> TC;
    while(TC--) {
        int N;
        cin >> N;
        vector<int> v(N);
        for(int i = 0; i < N; ++i)
            cin >> v[i];

        vector<int> count(200001, 0);
        vector<int> sorted_v;
        for(int i = 0; i < N; ++i) {
            if(count[v[i]] == 0) {
                count[v[i]]++;
                sorted_v.push_back(v[i]);
            } else {
                count[v[i]]++;
            }
        }

        sort(sorted_v.begin(), sorted_v.end());

        long long sum = 1;
        for(int i = 0; i < (int)sorted_v.size(); ) {
            if((long long)sorted_v[i] <= sum + (long long)count[sorted_v[i]] - 1) {
                sum += count[sorted_v[i]];
                i++;
            } else {
                long long cur = 0;
                int j;
                for(j = i; j < (int)sorted_v.size(); ++j) {
                    cur += count[sorted_v[j]];
                    if((long long)sorted_v[j] <= sum + cur - 1) {
                        sum += cur;
                        break;
                    }
                }
                i = j+1;
            }
        }

        cout << sum << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define f first
#define se second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define set(a,b) memset(a,b,sizeof(a))
#define count_setbits(n) __builtin_popcount(n)
#define mn *min_element
#define mx *max_element
#define t ll t; cin>>t; while(t--)
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    t
    {
        ll n;
        cin>>n;
        ll a[n];
        set<ll>s;
        map<ll,ll>m;
        ll count=1;
        ll count1=0;
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
            m[a[i]]++;
            s.insert(a[i]);
        }
        for(auto it=s.begin();it!=s.end();++it)
        {
          if(count>=*it)
          {
            count+=m[*it];
            s.erase(it);
          }
          else
          {
            if(m[*it]-1>0)
            {
               auto it1=it;
                while(it1!=s.begin())
                {
                   count1+=m[*it1];
                  //count1+=m[*it1];
                  it1--;
                }
                count1+=m[*it1];
                count+=count1;
            }
         }
        }
        cout<<count<<endl;
    }
}


#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define f first
#define se second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define set(a,b) memset(a,b,sizeof(a))
#define count_setbits(n) __builtin_popcount(n)
#define mn *min_element
#define mx *max_element
#define t ll t; cin>>t; while(t--)
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    t
    {
        ll n;
        cin>>n;
        ll a[n];
        set<ll>s;
        map<ll,ll>m;
        ll count=1;
        ll count1=0;
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
            m[a[i]]++;
            s.insert(a[i]);
        }
        for(auto it=s.begin();it!=s.end();it++)
        {
          if(count>=*it)
          {
            count+=m[*it];
            s.erase(it);
          }
          else
          {
            if(m[*it]-1)
            {
               auto it1=it;
                while(it1!=s.begin())
                {
                   count1+=m[*it1];
                  //count1+=m[*it1];
                  it1--;
                }
                count1+=m[*it1];
                count+=count1;
            }
         }
        }
        cout<<count<<endl;
        return 0;
    }
}


#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define f first
#define se second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define set(a,b) memset(a,b,sizeof(a))
#define count_setbits(n) __builtin_popcount(n)
#define mn *min_element
#define mx *max_element
#define t ll t; cin>>t; while(t--)
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    t
    {
        ll n;
        cin>>n;
        ll a[n];
        set<ll>s;
        map<ll,ll>m;
        ll count=1;
        ll count1=0;
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
            m[a[i]]++;
            s.insert(a[i]);
        }
        for(auto it=s.begin();it!=s.end();it++)
        {
          if(count>=*it)
          {
            count+=m[*it];
            s.erase(it);
          }
          else
          {
            if(m[*it]-1)
            {
               auto it1=it;
                while(it1!=s.begin())
                {
                   count1+=m[*it1];
                  //count1+=m[*it1];
                  it1--;
                }
                count1+=m[*it1];
                count+=count1;
            }
         }
        }
        cout<<count<<endl;
    }
}


#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define f first
#define se second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define set(a,b) memset(a,b,sizeof(a))
#define count_setbits(n) __builtin_popcount(n)
#define mn *min_element
#define mx *max_element
#define t ll t; cin>>t; while(t--)
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    t
    {
        ll n;
        cin>>n;
        ll a[n];
        set<ll>s;
        map<ll,ll>m;
        ll count=1;
        ll count1=0;
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
            m[a[i]]++;
            s.insert(a[i]);
        }
        for(auto it=s.begin();it!=s.end();++it)
        {
          if(count>=*it)
          {
            count+=m[*it];
            s.erase(it);
          }
          else
          {
            if(m[*it]-1>0)
            {
               auto it1=it;
                while(it1!=s.begin())
                {
                   count1+=m[*it1];
                  //count1+=m[*it1];
                  --it1;
                }
                count1+=m[*it1];
                count+=count1;
            }
         }
        }
        cout<<count<<endl;
        return 0;
    }
}


#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define f first
#define se second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define set(a,b) memset(a,b,sizeof(a))
#define count_setbits(n) __builtin_popcount(n)
#define mn *min_element
#define mx *max_element
#define t ll t; cin>>t; while(t--)
#define endl "\n"
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    t
    {
        ll n;
        cin>>n;
        ll a[n];
        set<ll>s;
        map<ll,ll>m;
        ll count=1;
        ll count1=0;
        for(ll i=0;i<n;i++)
        {
            cin>>a[i];
            m[a[i]]++;
            s.insert(a[i]);
        }
        for(auto it=s.begin();it!=s.end();it++)
        {
          if(count>=*it)
          {
            count+=m[*it];
            s.erase(it);
          }
          else
          {
            if(m[*it]-1>0)
            {
               auto it1=it;
                while(it1!=s.begin())
                {
                   count1+=m[*it1];
                  //count1+=m[*it1];
                  it1--;
                }
                count1+=m[*it1];
                count+=count1;
            }
         }
        }
        cout<<count<<endl;
    }
}


#include <bits/stdc++.h>
#include <iostream>
using namespace std;

int main()
{
	int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        int a[n+1];
        //a[0]=0;
        for(i=0;i<n;i++)
            cin>>a[i];
        int cnt=1,prev=0;
        sort(a,a+n+1);
        for(i=0;i<n;i++)
        {
            if(a[i]<=cnt)
            {
                //cout<<"hi"<<endl;
                cnt+=1;
                prev=i+1;
            }
            else
            {
                if(a[i]<=cnt+i-prev)
                {
                    cnt+=i-prev+1;
                    prev=i+1;
                }
            }
           // cout<<"i "<<i<<" cnt "<<cnt<<" prev "<<prev<<endl;
        }
        cout<<cnt<<endl;

    }
	return 0;
}