description: A rectangle with its opposite corners in (0, 0) and (w, h) and sides parallel to the axes is drawn on a plane.
  
  You are given a list of lattice points such that each point lies on a side of a rectangle but not in its corner. Also, there are at least two points on every side of a rectangle.
  
  Your task is to choose three points in such a way that: 
  
    * exactly two of them belong to the same side of a rectangle; 
    * the area of a triangle formed by them is maximum possible. 
  
  
  
  Print the doubled area of this triangle. It can be shown that the doubled area of any triangle formed by lattice points is always an integer.
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of testcases.
  
  The first line of each testcase contains two integers w and h (3 ≤ w, h ≤ 10^6) — the coordinates of the corner of a rectangle.
  
  The next two lines contain the description of the points on two horizontal sides. First, an integer k (2 ≤ k ≤ 2 ⋅ 10^5) — the number of points. Then, k integers x_1 < x_2 < ... < x_k (0 < x_i < w) — the x coordinates of the points in the ascending order. The y coordinate for the first line is 0 and for the second line is h.
  
  The next two lines contain the description of the points on two vertical sides. First, an integer k (2 ≤ k ≤ 2 ⋅ 10^5) — the number of points. Then, k integers y_1 < y_2 < ... < y_k (0 < y_i < h) — the y coordinates of the points in the ascending order. The x coordinate for the first line is 0 and for the second line is w.
  
  The total number of points on all sides in all testcases doesn't exceed 2 ⋅ 10^5.
  
  Output
  
  For each testcase print a single integer — the doubled maximum area of a triangle formed by such three points that exactly two of them belong to the same side.
  
  Example
  
  Input
  
  
  3
  5 8
  2 1 2
  3 2 3 4
  3 1 4 6
  2 4 5
  10 7
  2 3 9
  2 1 7
  3 1 3 4
  3 4 5 6
  11 5
  3 1 6 8
  3 3 6 8
  3 1 3 4
  2 2 4
  
  
  Output
  
  
  25
  42
  35
  
  Note
  
  The points in the first testcase of the example: 
  
    * (1, 0), (2, 0); 
    * (2, 8), (3, 8), (4, 8); 
    * (0, 1), (0, 4), (0, 6); 
    * (5, 4), (5, 5). 
  
  
  
  The largest triangle is formed by points (0, 1), (0, 6) and (5, 4) — its area is 25/2. Thus, the doubled area is 25. Two points that are on the same side are: (0, 1) and (0, 6).
solution: import os
  import sys
  from bisect import bisect, bisect_left, insort, insort_left
  from heapq import heapify, heappop, heappush, nlargest, nsmallest
  from io import BytesIO, IOBase
  from math import inf, sqrt
  from types import GeneratorType
  
  # Fast IO for Python
  
  BUFSIZE: int = 8192
  
  
  class FastIO(IOBase):
      newlines = 0
  
      def __init__(self, file):
          self._fd = file.fileno()
          self.buffer = BytesIO()
          self.writable = "x" in file.mode or "r" not in file.mode
          self.write = self.buffer.write if self.writable else None
  
      def read(self):
          while True:
              b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
              if not b:
                  break
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines = 0
          return self.buffer.read()
  
      def readline(self):
          while self.newlines == 0:
              b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
              self.newlines = b.count(b"\n") + (not b)
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines -= 1
          return self.buffer.readline()
  
      def flush(self):
          if self.writable:
              os.write(self._fd, self.buffer.getvalue())
              self.buffer.truncate(0), self.buffer.seek(0)
  
  
  class IOWrapper(IOBase):
      def __init__(self, file):
          self.buffer = FastIO(file)
          self.flush = self.buffer.flush
          self.writable = self.buffer.writable
          self.write = lambda s: self.buffer.write(s.encode("ascii"))
          self.read = lambda: self.buffer.read().decode("ascii")
          self.readline = lambda: self.buffer.readline().decode("ascii")
  
  
  def print(*args, **kwargs):
      """Prints the values to a stream, or to sys.stdout by default."""
      sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
      at_start = True
      for x in args:
          if not at_start:
              file.write(sep)
          file.write(str(x))
          at_start = False
      file.write(kwargs.pop("end", "\n"))
      if kwargs.pop("flush", False):
          file.flush()
  
  
  sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
  def input(): return sys.stdin.readline().rstrip("\r\n")
  
  
  # Bootstrap used for recursion, use yield instead of return
  
  def bootstrap(f, stack=[]):
      def wrappedfunc(*args, **kwargs):
          if stack:
              return f(*args, **kwargs)
          else:
              to = f(*args, **kwargs)
              while True:
                  if type(to) is GeneratorType:
                      stack.append(to)
                      to = next(to)
                  else:
                      stack.pop()
                      if not stack:
                          break
                      to = stack[-1].send(to)
              return to
      return wrappedfunc
  
  
  # Never use += for string concatenation
  # Always use .join for string concatenation
  # Use PyPy3 for Codeforces
  # Use Python3 for Codechef
  
  # Function to compute inverse of a under modulo m
  
  def modInverse(a, m):
  
      g = gcd(a, m)
  
      if (g != 1):
          return -1
  
      else:
          # If a and m are relatively prime,
          # then modulo inverse is a^(m-2) mode m
          return power(a, m - 2, m)
  
  
  # Function to compute x^y under modulo m
  
  def power(x, y, m):
  
      if (y == 0):
          return 1
  
      p = power(x, y // 2, m) % m
      p = (p * p) % m
  
      if(y % 2 == 0):
          return p
      else:
          return ((x * p) % m)
  
  
  # Function to return gcd of a and b
  
  def gcd(a, b):
      if (a == 0):
          return b
  
      return gcd(b % a, a)
  
  
  # Sieve of Eratosthenes to get prime upto n
  
  def SieveOfEratosthenes(n):
      prime = [True for i in range(n+1)]
      p = 2
      while (p * p <= n):
  
          # If prime[p] is not
          # changed, then it is a prime
          if (prime[p] == True):
  
              # Update all multiples of p
              for i in range(p * p, n+1, p):
                  prime[i] = False
          p += 1
  
      ans = set()
      for p in range(2, n+1):
          if prime[p]:
              ans.add(p)
  
      return ans
  
  
  MOD = 1000000007
  INT_MAX = inf
  INT_MIN = -inf
  
  
  # Main function
  
  def main():
      t = int(input())
      for _ in range(t):
          temp = list(map(int, input().split()))
          w, h = temp[0], temp[1]
          hp1 = list(map(int, input().split()))
          hp2 = list(map(int, input().split()))
          vp1 = list(map(int, input().split()))
          vp2 = list(map(int, input().split()))
          hp1.pop(0)
          hp2.pop(0)
          vp1.pop(0)
          vp2.pop(0)
          ans = -1
          ans = max((hp1[-1]-hp1[0])*h, ans)
          ans = max((hp2[-1]-hp2[0])*h, ans)
          ans = max((vp1[-1]-vp1[0])*w, ans)
          ans = max((vp2[-1]-vp2[0])*w, ans)
          print(ans)
  
  
  main()
  