import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Nipuna Samarasekara
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		FastPrinter out = new FastPrinter(outputStream);
		Task1 solver = new Task1();
		solver.solve(1, in, out);
		out.close();
	}
}

class Task1 {
    static long mod=1000000007;
    static long modPow(long a, int pow) {
    		long res = 1;
    		while (pow > 0) {
    			if ((pow & 1) != 0) {
    				res = res * a % mod;
    			}
    			pow >>= 1;
    			a = a * a % mod;
    		}
    		return res;
    	}


    // 689^*(
    public void solve(int testNumber, FastScanner in, FastPrinter out) {
    int t=in.nextInt();
    long[] fact = new long[2000007];
    long[] factInv = new long[2000007];
        fact[0]=1;
        factInv[0]=1;
        for (int i = 1; i < fact.length ; i++) {
           fact[i]=fact[i-1]*i;
           if (fact[i]>=mod)fact[i]%=mod;
           factInv[i]=modPow(fact[i], (int) (mod-2));
        }
        int x1,x2;
        long nCr;
        while (t-->0){
       //     System.out.println(t+" ttt");
         int r=in.nextInt(),c=in.nextInt();
         int r1=in.nextInt(),c1=in.nextInt();
         int r2=in.nextInt(),c2=in.nextInt();
        long ans=0;
            for (int i = c2+1; i <= c ; i++) {
              if (r1-1>0){
               x1=i-1;
               x2=r1-1-1;
               nCr = fact[x1+x2];
               nCr *=factInv[x1];
               if (nCr>=mod)nCr%=mod;
               nCr *=factInv[x2];
               if (nCr>=mod)nCr%=mod;
             long st=nCr;
                x1= c-i;
                x2= r-r1;
                  nCr = fact[x1+x2];
                  nCr *=factInv[x1];
                  if (nCr>=mod)nCr%=mod;
                  nCr *=factInv[x2];
                  if (nCr>=mod)nCr%=mod;

               st*=nCr;
                  if (st>=mod)st%=mod;

                  ans+=st;
                  if (ans>=mod)ans-=mod;


              }
            }

            for (int i = r2+1; i <= r ; i++) {
                if (c1-1>0){
                    x1=i-1;
                    x2=c1-1-1;
                    nCr = fact[x1+x2];
                    nCr *=factInv[x1];
                    if (nCr>=mod)nCr%=mod;
                    nCr *=factInv[x2];
                    if (nCr>=mod)nCr%=mod;
                    long st=nCr;
          //          System.out.println("2 1 sst "+st);
                    x1= r-i;
                    x2= c-c1;
                    nCr = fact[x1+x2];
                    nCr *=factInv[x1];
                    if (nCr>=mod)nCr%=mod;
                    nCr *=factInv[x2];
                    if (nCr>=mod)nCr%=mod;

                    st*=nCr;
                    if (st>=mod)st%=mod;
           //         System.out.println("2 2 sst "+st);

                    ans+=st;
                    if (ans>=mod)ans-=mod;


                }
            }
            out.println(ans);



        }
    }
}

class FastScanner extends BufferedReader {

    public FastScanner(InputStream is) {
        super(new InputStreamReader(is));
    }

    public int read() {
        try {
            int ret = super.read();
//            if (isEOF && ret < 0) {
//                throw new InputMismatchException();
//            }
//            isEOF = ret == -1;
            return ret;
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    static boolean isWhiteSpace(int c) {
        return c >= 0 && c <= 32;
    }

    public int nextInt() {
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int ret = 0;
        while (c >= 0 && !isWhiteSpace(c)) {
            if (c < '0' || c > '9') {
                throw new NumberFormatException("digit expected " + (char) c
                        + " found");
            }
            ret = ret * 10 + c - '0';
            c = read();
        }
        return ret * sgn;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }

}

class FastPrinter extends PrintWriter {

    public FastPrinter(OutputStream out) {
        super(out);
    }


}