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 java.io.IOException;
  import java.io.InputStream;
  import java.math.BigInteger;
  import java.util.*;
  
  public class Main {
  
      public static void main(String[] args) {
          // write your code here
          boolean readFromLocal = true;
          //readFromLocal = false;
          String filepath = "src/input.txt";
          //FileInputStream fileInputStream = new FileInputStream(filepath);
          InputReader inputReader = new InputReader(System.in);
          Solve s = new Solve();
          s.solve(inputReader);
      }
  }
  
  class Solve {
  
      public void solve(InputReader inputReader) {
          int t = inputReader.nextInt();
          long mod = 1000_000_000 + 9;
          while (t > 0) {
              t--;
              long w = inputReader.nextLong();
              long h = inputReader.nextLong();
              long x0 = getMaxSideLength(inputReader);
              long x1 = getMaxSideLength(inputReader);
              long y0 = getMaxSideLength(inputReader);
              long y1 = getMaxSideLength(inputReader);
              long res = Math.max(x0,x1)*h;
              res = Math.max(res,Math.max(y0,y1)*w);
              System.out.println(res);
          }
      }
  
      private long getMaxSideLength(InputReader inputReader) {
          long t1,t2;
          int k = inputReader.nextInt();
          t1 = inputReader.nextLong();
          t2 = t1;
          for (int i = 1; i < k ; i++) {
              t2 = inputReader.nextLong();
          }
          return t2 - t1;
      }
  }
  
  class Pair implements Comparable<Pair> {
      int first,second;
  
      public Pair(int first, int second) {
          this.first = first;
          this.second = second;
      }
  
      @Override
      public int compareTo(Pair o) {
          return this.second - o.second;
      }
  }
  class Utils {
      static void swap(int[] res, int i, int j) {
          int temp = res[i];
          res[i] = res[j];
          res[j] = temp;
      }
  
      static long pow(long num, int n, long mod) {
          long res = num%mod;
          while (n > 0) {
              if ((n & 1) != 0) {
                  res = (res * num) % mod;
              }
              num = (num * num) % mod;
              n >>= 1;
          }
          return res;
      }
  
  }
  
  class InputReader {
      private boolean finished = false;
  
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
  
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
  
      public int read() {
          if (numChars == -1) {
              throw new InputMismatchException();
          }
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0) {
                  return -1;
              }
          }
          return buf[curChar++];
      }
  
      public int peek() {
          if (numChars == -1) {
              return -1;
          }
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  return -1;
              }
              if (numChars <= 0) {
                  return -1;
              }
          }
          return buf[curChar];
      }
  
      public int nextInt() {
          int c = read();
          while (isSpaceChar(c)) {
              c = read();
          }
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = read();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9') {
                  throw new InputMismatchException();
              }
              res *= 10;
              res += c - '0';
              c = read();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
  
      public long nextLong() {
          int c = read();
          while (isSpaceChar(c)) {
              c = read();
          }
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = read();
          }
          long res = 0;
          do {
              if (c < '0' || c > '9') {
                  throw new InputMismatchException();
              }
              res *= 10;
              res += c - '0';
              c = read();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
  
      public String nextString() {
          int c = read();
          while (isSpaceChar(c)) {
              c = read();
          }
          StringBuilder res = new StringBuilder();
          do {
              if (Character.isValidCodePoint(c)) {
                  res.appendCodePoint(c);
              }
              c = read();
          } while (!isSpaceChar(c));
          return res.toString();
      }
  
      public boolean isSpaceChar(int c) {
          if (filter != null) {
              return filter.isSpaceChar(c);
          }
          return isWhitespace(c);
      }
  
      public static boolean isWhitespace(int c) {
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
  
      private String readLine0() {
          StringBuilder buf = new StringBuilder();
          int c = read();
          while (c != '\n' && c != -1) {
              if (c != '\r') {
                  buf.appendCodePoint(c);
              }
              c = read();
          }
          return buf.toString();
      }
  
      public String readLine() {
          String s = readLine0();
          while (s.trim().length() == 0) {
              s = readLine0();
          }
          return s;
      }
  
      public String readLine(boolean ignoreEmptyLines) {
          if (ignoreEmptyLines) {
              return readLine();
          } else {
              return readLine0();
          }
      }
  
      public BigInteger readBigInteger() {
          try {
              return new BigInteger(nextString());
          } catch (NumberFormatException e) {
              throw new InputMismatchException();
          }
      }
  
      public char nextCharacter() {
          int c = read();
          while (isSpaceChar(c)) {
              c = read();
          }
          return (char) c;
      }
  
      public double nextDouble() {
          int c = read();
          while (isSpaceChar(c)) {
              c = read();
          }
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = read();
          }
          double res = 0;
          while (!isSpaceChar(c) && c != '.') {
              if (c == 'e' || c == 'E') {
                  return res * Math.pow(10, nextInt());
              }
              if (c < '0' || c > '9') {
                  throw new InputMismatchException();
              }
              res *= 10;
              res += c - '0';
              c = read();
          }
          if (c == '.') {
              c = read();
              double m = 1;
              while (!isSpaceChar(c)) {
                  if (c == 'e' || c == 'E') {
                      return res * Math.pow(10, nextInt());
                  }
                  if (c < '0' || c > '9') {
                      throw new InputMismatchException();
                  }
                  m /= 10;
                  res += (c - '0') * m;
                  c = read();
              }
          }
          return res * sgn;
      }
  
      public boolean isExhausted() {
          int value;
          while (isSpaceChar(value = peek()) && value != -1) {
              read();
          }
          return value == -1;
      }
  
      public String next() {
          return nextString();
      }
  
      public SpaceCharFilter getFilter() {
          return filter;
      }
  
      public void setFilter(SpaceCharFilter filter) {
          this.filter = filter;
      }
  
      public interface SpaceCharFilter {
          boolean isSpaceChar(int ch);
      }
  
      public int[] nextIntArray(int n) {
          int[] array = new int[n];
          for (int i = 0; i < n; ++i) array[i] = nextInt();
          return array;
      }
  
      public int[] nextSortedIntArray(int n) {
          int[] array = nextIntArray(n);
          Arrays.sort(array);
          return array;
      }
  
      public int[] nextSumIntArray(int n) {
          int[] array = new int[n];
          array[0] = nextInt();
          for (int i = 1; i < n; ++i) array[i] = array[i - 1] + nextInt();
          return array;
      }
  
      public long[] nextLongArray(int n) {
          long[] array = new long[n];
          for (int i = 0; i < n; ++i) array[i] = nextLong();
          return array;
      }
  
      public long[] nextSumLongArray(int n) {
          long[] array = new long[n];
          array[0] = nextInt();
          for (int i = 1; i < n; ++i) array[i] = array[i - 1] + nextInt();
          return array;
      }
  
      public long[] nextSortedLongArray(int n) {
          long[] array = nextLongArray(n);
          Arrays.sort(array);
          return array;
      }
  }