#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define reps(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define repit(i,C) for (auto i = (C).begin(); i != (C).end(); i++)
#define pr(a) cout << a
#define prl(a) cout << (a) << endl
#define prld(a) cout << setprecision(15)<< (a) << endl 
#define allrange(a) a.begin(),a.end()

bool solve_translated(vector<pair<int,int>> &S,vector<pair<int,int>> &T){
    int N = S.size();
    int dx = S[0].first-T[0].first;
    int dy = S[0].second-T[0].second;
    bool flg = true;
    reps(i,1,N){
        if(!((S[i].first==T[i].first+dx) && (S[i].second==T[i].second+dy))){flg = false; break;} 
    }
    return flg;
}
/*ピタゴラ三角形
    5	12	13
    8	15	17
    3	4	5
*/  
vector<pair<int,int>> Pitagora_rot(vector<pair<int,int>> &S,int a, int b , int c){
    int N = S.size();
    vector<pair<int,int>> PS(N);
    auto pt0 = S[0];
    PS[0] = pt0;
    bool flg = true;
    reps(i,1,N){
        int dx = S[i].first - pt0.first;
        int dy = S[i].second - pt0.second;
        if(((dx*b+dy*a)%c)!=0 || ((dx*a-dy*b)%c)!=0) {flg = false; break;}
        PS[i] = make_pair((dx*a-dy*b)/c+pt0.first, (dx*b+dy*a)/c+pt0.second);
    }
    if(flg) return PS;
    else return vector<pair<int,int>>();
}


int main(){
    std::cin.tie(0); // cinとcoutの同期を解除
    std::ios::sync_with_stdio(false);
    int N;cin >> N;
    bool flg=true;

    vector<pair<int,int>> S(N),T(N);
    rep(i,N)
    {
        int x,y;
        cin >> x >> y;
        S[i].first = x;S[i].second = y;
    }

    rep(i,N)
    {
        int x,y;
        cin >> x >> y;
        T[i].first = x;
        T[i].second = y;
    }
    sort(allrange(T));
  
/*ピタゴラ三角形
    5	12	13
    8	15	17
    3	4	5
*/  
    vector<vector<int>> tri(0);
    tri.push_back(vector<int>({5, 12, 13}));
 //   tri.push_back(vector<int>({12, 5, 13}));
 //   tri.push_back(vector<int>({8,15,17}));
 //   tri.push_back(vector<int>({15,8,17}));
    tri.push_back(vector<int>({3,4,5}));
    tri.push_back(vector<int>({4,3,5}));
    tri.push_back(vector<int>({0,1,1}));
    tri.push_back(vector<int>({-1,0,1}));
    tri.push_back(vector<int>({0,-1,1}));
    tri.push_back(vector<int>({1,0,1}));
   //tri.push_back(vector<int>({-5, 12, 13}));
  //  tri.push_back(vector<int>({-12, 5, 13}));
  //  tri.push_back(vector<int>({-8,15,17}));
  //  tri.push_back(vector<int>({-15,8,17}));
    tri.push_back(vector<int>({-3,4,5}));
    tri.push_back(vector<int>({-4,3,5}));
 //   tri.push_back(vector<int>({-5, -12, 13}));
 //   tri.push_back(vector<int>({-12, -5, 13}));
 //   tri.push_back(vector<int>({-8,-15,17}));
 //   tri.push_back(vector<int>({-15,-8,17}));
    tri.push_back(vector<int>({-3,-4,5}));
    tri.push_back(vector<int>({-4,-3,5}));
 //   tri.push_back(vector<int>({5, -12, 13}));
 //   tri.push_back(vector<int>({12, -5, 13}));
 //   tri.push_back(vector<int>({8,-15,17}));
    tri.push_back(vector<int>({15,-8,17}));
    tri.push_back(vector<int>({3,-4,5}));
    tri.push_back(vector<int>({4,-3,5}));

    flg=false;

    if(S.size()==2 && T.size()==2){
        auto sx = S[0].first-S[1].first;
        auto sy = S[0].second-S[1].second;
        auto tx = T[0].first-T[1].first;
        auto ty = T[0].second-T[1].second;
        flg= (sx*sx+sy*sy==tx*tx+ty*ty);
    } else {
        rep(j,tri.size()){    
            auto S2 = Pitagora_rot(S,tri[j][0],tri[j][1],tri[j][2]);
            if(S2.empty()) continue;
            sort(allrange(S2));
            flg = solve_translated(S2,T);
            if(flg) break;
        }
    }
    if(flg) prl("Yes"); else prl("No");
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define all(x) x.begin(),x.end()
struct point{
    ll x,y,idx;
};
bool srt1(point & p1, point & p2){
    return p1.x<p2.x;
}
bool srt2(point & p1, point & p2){
    return p1.y<p2.y;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector<point> arr(n);
    REP(i,n){
        cin>>arr[i].x>>arr[i].y;
        arr[i].idx=i;
    }
    sort(all(arr),srt1);
    map<pair<ll,ll>,ll> m;
    m[mp(min(arr[n-1].idx,arr[0].idx),max(arr[n-1].idx,arr[0].idx))]=max(arr[n-1].x-arr[0].x,m[mp(min(arr[n-1].idx,arr[0].idx),max(arr[n-1].idx,arr[0].idx))]);

    m[mp(min(arr[n-1].idx,arr[1].idx),max(arr[n-1].idx,arr[1].idx))]=max(arr[n-1].x-arr[1].x,m[mp(min(arr[n-1].idx,arr[1].idx),max(arr[n-1].idx,arr[1].idx))]);

    m[mp(min(arr[n-2].idx,arr[0].idx),max(arr[n-2].idx,arr[0].idx))]=max(arr[n-2].x-arr[0].x,m[mp(min(arr[n-2].idx,arr[0].idx),max(arr[n-2].idx,arr[0].idx))]);

    sort(all(arr),srt2);

    m[mp(min(arr[n-1].idx,arr[0].idx),max(arr[n-1].idx,arr[0].idx))]=max(arr[n-1].y-arr[0].y,m[mp(min(arr[n-1].idx,arr[0].idx),max(arr[n-1].idx,arr[0].idx))]);

    m[mp(min(arr[n-1].idx,arr[1].idx),max(arr[n-1].idx,arr[1].idx))]=max(arr[n-1].y-arr[1].y,m[mp(min(arr[n-1].idx,arr[1].idx),max(arr[n-1].idx,arr[1].idx))]);

     m[mp(min(arr[n-2].idx,arr[0].idx),max(arr[n-2].idx,arr[0].idx))]=max(arr[n-2].y-arr[0].y,m[mp(min(arr[n-2].idx,arr[0].idx),max(arr[n-2].idx,arr[0].idx))]);
     vector<ll> aux;
     for(auto & [x,y]:m){
        aux.pb(y);
     }
     sort(all(aux));
     reverse(all(aux));
     cout<<aux[1]<<endl;

}
