import Data.List
import qualified Data.ByteString.Char8 as B
import Control.Monad
import Data.Ord
main = readLn >>= flip replicateM breadIs >>= print . solve

solve :: [[Integer]] -> Integer
solve xs = minimum [(maxv - minv) * minimum [maximum (a : b : maxs) - minimum (a : b : maxs), maximum (a : b : mins) - minimum (a : b : mins)], (maxv - minimum (a : maxs)) * (maximum (b : mins) - minv)]
    where
        mas = minimumBy (comparing minimum) xs
        mbs = maximumBy (comparing maximum) xs
        [minv, a] = sort mas
        [b, maxv] = sort mbs
        (mins, maxs) = foldr ff ([], []) $ filter (\x -> x /= mas && x /= mbs) xs
        ff [x,  y] (acc, bcc)
            | x < y = (x : acc, y : bcc)
            | otherwise = (y : acc, x : bcc)


breadIs :: IO [Integer]
breadIs = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInteger b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)
