There are N bags, each containing two white balls. The i-th box contains two balls with integers x_i and y_i written on them, respectively.
For each of these bags, you will paint one of the balls red, and paint the other blue.
Afterwards, the 2N balls will be classified according to color.
Then, we will define the following:
 - R_{max}: the maximum integer written on a ball painted in red
 - R_{min}: the minimum integer written on a ball painted in red
 - B_{max}: the maximum integer written on a ball painted in blue
 - B_{min}: the minimum integer written on a ball painted in blue
Find the minimum possible value of (R_{max} - R_{min}) \times (B_{max} - B_{min}).

-----Constraints-----
 - 1 ≤ N ≤ 200,000
 - 1 ≤ x_i, y_i ≤ 10^9

-----Input-----
Input is given from Standard Input in the following format:
N
x_1 y_1
x_2 y_2
:
x_N y_N

-----Output-----
Print the minimum possible value.

-----Sample Input-----
3
1 2
3 4
5 6

-----Sample Output-----
15

The optimal solution is to paint the balls with x_1, x_2, y_3 red, and paint the balls with y_1, y_2, x_3 blue.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '#####segfunc#####\ndef segfunc(x, y):\n    return min(x,y)\n#################\n\n#####ide_ele#####\nide_ele = float("inf")\n#################\n\nclass SegTree:\n    """\n    init(init_val, ide_ele): 配列init_valで初期化 O(N)\n    update(k, x): k番目の値をxに更新 O(logN)\n    query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)\n    """\n    def __init__(self, init_val, segfunc, ide_ele):\n        """\n        init_val: 配列の初期値\n        segfunc: 区間にしたい操作\n        ide_ele: 単位元\n        n: 要素数\n        num: n以上の最小の2のべき乗\n        tree: セグメント木(1-index)\n        """\n        n = len(init_val)\n        self.segfunc = segfunc\n        self.ide_ele = ide_ele\n        self.num = 1 << (n - 1).bit_length()\n        self.tree = [ide_ele] * 2 * self.num\n        # 配列の値を葉にセット\n        for i in range(n):\n            self.tree[self.num + i] = init_val[i]\n        # 構築していく\n        for i in range(self.num - 1, 0, -1):\n            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])\n\n    def update(self, k, x):\n        """\n        k番目の値をxに更新\n        k: index(0-index)\n        x: update value\n        """\n        k += self.num\n        self.tree[k] = x\n        while k > 1:\n            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])\n            k >>= 1\n\n    def query(self, l, r):\n        """\n        [l, r)のsegfuncしたものを得る\n        l: index(0-index)\n        r: index(0-index)\n        """\n        res = self.ide_ele\n\n        l += self.num\n        r += self.num\n        while l < r:\n            if l & 1:\n                res = self.segfunc(res, self.tree[l])\n                l += 1\n            if r & 1:\n                res = self.segfunc(res, self.tree[r - 1])\n            l >>= 1\n            r >>= 1\n        return res\n\ndef main():\n    import sys,random\n\n    input=sys.stdin.readline\n\n    N=int(input())\n    q=[]\n    r=[]\n    b=[]\n    X=0\n    q_append=q.append\n    for i in range(N):\n        x,y=list(map(int,input().split()))\n        r.append(max(x,y))\n        b.append(min(x,y))\n\n\n    X=max(b)\n    init_val=[b[i] for i in range(N)]\n    for i in range(N):\n        x,y=r[i],b[i]\n        if X>r[i]:\n            init_val[i]=r[i]\n        elif X>b[i]:\n            q_append((r[i],i,-1))\n            init_val[i]=b[i]\n        else:\n            q_append((b[i],i,1))\n            q_append((r[i],i,-1))\n            init_val[i]=b[i]\n\n    q.sort()\n    test1=float("inf")\n    rmq=SegTree(init_val,segfunc,ide_ele)\n    \n\n    for i in range(0,len(q)):\n        val,index,k=q[i]\n        if k==-1:\n            rmq.update(index,val)\n        res=rmq.query(0,N)\n        test1=min(val-res,test1)\n\n\n    test2=(max(r)-min(r))*(max(b)-min(b))\n    test1*=(max(max(b),max(r))-min(min(b),min(r)))\n    print((min(test1,test2)))\n\ndef __starting_point():\n    main()\n\n__starting_point()'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 18875