Recently, Masha was presented with a chessboard with a height of n and a width of m.

The rows on the chessboard are numbered from 1 to n from bottom to top. The columns are numbered from 1 to m from left to right. Therefore, each cell can be specified with the coordinates (x,y), where x is the column number, and y is the row number (do not mix up).

Let us call a rectangle with coordinates (a,b,c,d) a rectangle lower left point of which has coordinates (a,b), and the upper right one — (c,d).

The chessboard is painted black and white as follows:

<image> An example of a chessboard.

Masha was very happy with the gift and, therefore, invited her friends Maxim and Denis to show off. The guys decided to make her a treat — they bought her a can of white and a can of black paint, so that if the old board deteriorates, it can be repainted. When they came to Masha, something unpleasant happened: first, Maxim went over the threshold and spilled white paint on the rectangle (x_1,y_1,x_2,y_2). Then after him Denis spilled black paint on the rectangle (x_3,y_3,x_4,y_4).

To spill paint of color color onto a certain rectangle means that all the cells that belong to the given rectangle become color. The cell dyeing is superimposed on each other (if at first some cell is spilled with white paint and then with black one, then its color will be black).

Masha was shocked! She drove away from the guests and decided to find out how spoiled the gift was. For this, she needs to know the number of cells of white and black color. Help her find these numbers!

Input

The first line contains a single integer t (1 ≤ t ≤ 10^3) — the number of test cases.

Each of them is described in the following format:

The first line contains two integers n and m (1 ≤ n,m ≤ 10^9) — the size of the board.

The second line contains four integers x_1, y_1, x_2, y_2 (1 ≤ x_1 ≤ x_2 ≤ m, 1 ≤ y_1 ≤ y_2 ≤ n) — the coordinates of the rectangle, the white paint was spilled on.

The third line contains four integers x_3, y_3, x_4, y_4 (1 ≤ x_3 ≤ x_4 ≤ m, 1 ≤ y_3 ≤ y_4 ≤ n) — the coordinates of the rectangle, the black paint was spilled on.

Output

Output t lines, each of which contains two numbers — the number of white and black cells after spilling paint, respectively.

Example

Input


5
2 2
1 1 2 2
1 1 2 2
3 4
2 2 3 2
3 1 4 3
1 5
1 1 5 1
3 1 5 1
4 4
1 1 4 2
1 3 4 4
3 4
1 2 4 2
2 1 3 3


Output


0 4
3 9
2 3
8 8
4 8

Note

Explanation for examples:

The first picture of each illustration shows how the field looked before the dyes were spilled. The second picture of each illustration shows how the field looked after Maxim spoiled white dye (the rectangle on which the dye was spilled is highlighted with red). The third picture in each illustration shows how the field looked after Denis spoiled black dye (the rectangle on which the dye was spilled is highlighted with red).

In the first test, the paint on the field changed as follows:

<image>

In the second test, the paint on the field changed as follows:

<image>

In the third test, the paint on the field changed as follows:

<image>

In the fourth test, the paint on the field changed as follows:

<image>

In the fifth test, the paint on the field changed as follows:

<image>
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		InputStream input;
		OutputStream output;
		try {
			input = new FileInputStream("input.txt");
			output = new FileOutputStream("output.txt");
		} catch (FileNotFoundException e) {
			input = System.in;
			output = System.out;
		}
		Kattio io = new Kattio(input, output);
		int t=io.getInt();
		for (int i=1; i<=t; i++)
			(new Solve(io)).main();
		io.close();

		if (input instanceof FileInputStream)
			try {
				input.close();
			} catch (IOException e) {
			}
		if (output instanceof FileOutputStream)
			try {
				output.close();
			} catch (IOException e) {
			}
	}

}

class Solve {
	Kattio io;

	long n,m;
	Point A,B,C,D;
	
	Solve(Kattio io) {
		this.io = io;
	}

	long calculateWhite(long row,long col1,long col2)
	{
		if ((row+col1)%2==0)
			return (col2-col1)/2+1;
		else
			return (col2-col1+1)/2;
	}
	
	
	long calculateWhite(Point A,Point B)
	{
		if (A.col>B.col || A.row>B.row)
			return Long.MAX_VALUE;
		
		return (((B.row-A.row)/2+1)*calculateWhite(A.row,A.col,B.col)+(B.row-A.row+1)/2*calculateWhite(A.row+1,A.col,B.col));
	}
	
	
	void main() {
		
		n=io.getLong();
		m=io.getLong();
		
		A=new Point(io.getLong(),io.getLong());
		B=new Point(io.getLong(),io.getLong());
		C=new Point(io.getLong(),io.getLong());
		D=new Point(io.getLong(),io.getLong());
		
		//io.println(n+" "+m);
		long white=(n*m+1)/2;
		
		//io.println(white);
		
		long black1=(Math.abs(A.row-B.row)+1)*(Math.abs(A.col-B.col)+1)-calculateWhite(A,B);
		
		white+=black1;
		
		//io.println(white);
		
		long white2=calculateWhite(C,D);
		
		white-=white2;
		
		Point E = new Point(Math.max(A.col, C.col),Math.max(A.row, C.row));
		Point F = new Point(Math.min(B.col, D.col),Math.min(B.row, D.row));
		
		//io.println(E+" "+F);
		
		if (calculateWhite(E,F)!=Long.MAX_VALUE)
		{
			long black3=(Math.abs(E.row-F.row)+1)*(Math.abs(E.col-F.col)+1)-calculateWhite(E,F);
		
			//io.println(black3);
		
			white-=black3;
		}
		
		//io.println(white);
		
		io.println(white+" "+(n*m-white));
		//io.println();
		
	}
}

class Point
{
	long col;
	long row;
	public long getCol() {
		return col;
	}
	public void setCol(long col) {
		this.col = col;
	}
	public long getRow() {
		return row;
	}
	public void setRow(long row) {
		this.row = row;
	}
	public Point(long col, long row) {
		super();
		this.col = col;
		this.row = row;
	}
	@Override
	public String toString() {
		return "Point [col=" + col + ", row=" + row + "]";
	}
	
	
	
}

/** Simple yet moderately fast I/O routines.
*
* Example usage:
*
* Kattio io = new Kattio(System.in, System.out);
*
* while (io.hasMoreTokens()) {
*    int n = io.getInt();
*    double d = io.getDouble();
*    double ans = d*n;
*
*    io.println("Answer: " + ans);
* }
*
* io.close();
*
*
* Some notes:
*
* - When done, you should always do io.close() or io.flush() on the
*   Kattio-instance, otherwise, you may lose output.
*
* - The getInt(), getDouble(), and getLong() methods will throw an
*   exception if there is no more data in the input, so it is generally
*   a good idea to use hasMoreTokens() to check for end-of-file.
*
* @author: Kattis
*/
class Kattio extends PrintWriter {
	public Kattio(InputStream i) {
		super(new BufferedOutputStream(System.out));
		r = new BufferedReader(new InputStreamReader(i));
	}

	public Kattio(InputStream i, OutputStream o) {
		super(new BufferedOutputStream(o));
		r = new BufferedReader(new InputStreamReader(i));
	}

	public boolean hasMoreTokens() {
		return peekToken() != null;
	}

	public int getInt() {
		return Integer.parseInt(nextToken());
	}

	public double getDouble() {
		return Double.parseDouble(nextToken());
	}

	public long getLong() {
		return Long.parseLong(nextToken());
	}

	public String getWord() {
		return nextToken();
	}

	private BufferedReader r;
	private String line;
	private StringTokenizer st;
	private String token;

	private String peekToken() {
		if (token == null)
			try {
				while (st == null || !st.hasMoreTokens()) {
					line = r.readLine();
					if (line == null)
						return null;
					st = new StringTokenizer(line);
				}
				token = st.nextToken();
			} catch (IOException e) {
			}
		return token;
	}

	private String nextToken() {
		String ans = peekToken();
		token = null;
		return ans;
	}
}