// Arup Guha
// 1/9/2024
// Terrible Solution to 2016 Dec USACO Bronze Problem: Square Pasture

using namespace std;
#include <bits/stdc++.h>

int min(int a, int b, int c, int d);
int max(int a, int b, int c, int d);

int main() {

    // Open file (for old usaco not any more)
    ifstream fin("square.in");

    // Read pts.
    int r1[4], r2[4];
    for (int i=0; i<4; i++)
        fin >> r1[i];
    for (int i=0; i<4; i++)
        fin >> r2[i];

    // Close file.
    fin.close();

    // Find min and max of x, y.
    int minx = min(r1[0], r1[2], r2[0], r2[2]);
    int maxx = max(r1[0], r1[2], r2[0], r2[2]);
    int miny = min(r1[1], r1[3], r2[1], r2[3]);
    int maxy = max(r1[1], r1[3], r2[1], r2[3]);

    // This is what we want.
    int diffx = maxx-minx;
    int diffy = maxy-miny;

    // Take the larger one and square it.
    int sq = diffx > diffy ? diffx : diffy;

    // Write to file.
    ofstream fout("square.out");
    fout << sq*sq << endl;
    fout.close();

    return 0;
}

// Returns the smallest of a,b,c,d.
int min(int a, int b, int c, int d) {
    if (a<b && a<c && a<d) return a;
    if (b<c && b<d) return b;
    if (c<d) return c;
    return d;
}

// Returns the largest of a,b,c,d.
int max(int a, int b, int c, int d) {
    if (a>b && a>c && a>d) return a;
    if (b>c && b>d) return b;
    if (c>d) return c;
    return d;
}
