Problem: Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! 

Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: 

  * exactly a steps left: from (u,v) to (u-1,v); 
  * exactly b steps right: from (u,v) to (u+1,v); 
  * exactly c steps down: from (u,v) to (u,v-1); 
  * exactly d steps up: from (u,v) to (u,v+1). 



Note that the moves can be performed in an arbitrary order. For example, if the cat has to move 1 step left, 3 steps right and 2 steps down, then the walk right, down, left, right, right, down is valid.

Alice, however, is worrying that her cat might get lost if it moves far away from her. So she hopes that her cat is always in the area [x_1,x_2]× [y_1,y_2], i.e. for every cat's position (u,v) of a walk x_1 ≤ u ≤ x_2 and y_1 ≤ v ≤ y_2 holds.

Also, note that the cat can visit the same cell multiple times.

Can you help Alice find out if there exists a walk satisfying her wishes?

Formally, the walk should contain exactly a+b+c+d unit moves (a to the left, b to the right, c to the down, d to the up). Alice can do the moves in any order. Her current position (u, v) should always satisfy the constraints: x_1 ≤ u ≤ x_2, y_1 ≤ v ≤ y_2. The staring point is (x, y).

You are required to answer t test cases independently.

Input

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

The first line of each test case contains four integers a, b, c, d (0 ≤ a,b,c,d ≤ 10^8, a+b+c+d ≥ 1).

The second line of the test case contains six integers x, y, x_1, y_1, x_2, y_2 (-10^8 ≤ x_1≤ x ≤ x_2 ≤ 10^8, -10^8 ≤ y_1 ≤ y ≤ y_2 ≤ 10^8).

Output

For each test case, output "YES" in a separate line, if there exists a walk satisfying her wishes. Otherwise, output "NO" in a separate line. 

You can print each letter in any case (upper or lower).

Example

Input


6
3 2 2 2
0 0 -2 -2 2 2
3 1 4 1
0 0 -1 -1 1 1
1 1 1 1
1 1 1 1 1 1
0 0 0 1
0 0 0 0 0 1
5 1 1 1
0 0 -100 -100 0 100
1 1 5 1
0 0 -100 -100 100 0


Output


Yes
No
No
Yes
Yes
Yes

Note

In the first test case, one valid exercising walk is $$$(0,0)→ (-1,0) → (-2,0)→ (-2,1) → (-2,2)→ (-1,2)→(0,2)→ (0,1)→ (0,0) → (-1,0)$$$

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;  

public class Solution{
    public static class pair{
        int x;
        int y;
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(br.readLine());
        while(t-->0){
            String line=br.readLine();
            String[] strs=line.trim().split(" ");
            long a=Long.parseLong(strs[0]);
            long b=Long.parseLong(strs[1]);
            long c=Long.parseLong(strs[2]);
            long d=Long.parseLong(strs[3]);
            line=br.readLine();
            strs=line.trim().split(" ");
            long x=Long.parseLong(strs[0]);
            long y=Long.parseLong(strs[1]);
            long x1=Long.parseLong(strs[2]);
            long y1=Long.parseLong(strs[3]);
            long x2=Long.parseLong(strs[4]);
            long y2=Long.parseLong(strs[5]);
            long xmax=Math.max((long)Math.abs(x-x1),(long)Math.abs(x-x2));
            long ymax=Math.max((long)Math.abs(y-y1),(long)Math.abs(y-y2));
            long xm=(long)Math.abs(a-b);
            long ym=(long)Math.abs(c-d);
            if(xmax==0&&(a>0||b>0)){
                System.out.println("No");
                continue;
            }
            if(ymax==0&&(c>0||d>0)){
                System.out.println("No");
                continue;
            }
            if(a>=b){
                long d1=a-b;
                long v1=(long)Math.abs(x-x1);
                if(c>=d){
                    long d2=c-d;
                    long v2=(long)Math.abs(y-y1);
                    if(xm<=xmax&&ym<=ymax&&v1>=d1&&v2>=d2){
                        System.out.println("Yes");
                    }else{
                        System.out.println("No");
                    }
                }else{
                    long d2=d-c;
                    long v2=(long)Math.abs(y2-y);
                    if(xm<=xmax&&ym<=ymax&&v1>=d1&&v2>=d2){
                        System.out.println("Yes");
                    }else{
                        System.out.println("No");
                    }
                }
            }else{
                long d1=b-a;
                long v1=(long)Math.abs(x2-x);
                if(c>=d){
                    long d2=c-d;
                    long v2=(long)Math.abs(y-y1);
                    if(xm<=xmax&&ym<=ymax&&v1>=d1&&v2>=d2){
                        System.out.println("Yes");
                    }else{
                        System.out.println("No");
                    }
                }else{
                    long d2=d-c;
                    long v2=(long)Math.abs(y2-y);
                    if(xm<=xmax&&ym<=ymax&&v1>=d1&&v2>=d2){
                        System.out.println("Yes");
                    }else{
                        System.out.println("No");
                    }
                }
            }
            
            // if(xm<=xmax&&ym<=ymax){
            //     System.out.println("Yes");
            // }else{
            //     System.out.println("No");
            // }
            
        }
    }
    public static long quala(long b){
        long val=(long)Math.ceil(Math.pow(1+(8*b),0.5));
        if(val%2==0){
            long va=(long)(2+val)/(long)2;
            return va;
        }else{
            long va=(long)(1+val)/(long)2;
            return va;
        }
    }
    public static String find(int a,int b){
        if(a==3){
            if(b==1){
                return "abb";
            }else if(b==2){
                return "bab";
            }else{
                return "bba";
            }
        }
        int v=((a-1)*(a-2))/2;
        if(b<=v){
            String s=find(a-1,b);
            StringBuffer sb=new StringBuffer(s);
            int diff=a-s.length();
            while(diff-->0){
                sb.insert(0,"a");
            }
            return sb.toString();
        }else{
            int diff=b-v;
            StringBuffer sb=new StringBuffer();
            sb.append("b");
            for(int i=0;i<a-diff-1;i++){
                sb.append("a");
            }
            sb.append("b");
            for(int i=0;i<diff-1;i++){
                sb.append("a");
            }
            return sb.toString();
        }
        // return new String("a"+s);
    }
    public static long z(long val){
        long p=1;
        while(val!=0){
            long rem=val%10;
            p*=rem;
            val=val/10;
        }
        return p;
    }
    public static int[] soe(int n){
        int[] arr=new int[n];
        arr[0]=0;
        for(int i=1;i<n;i++){
            if(arr[i]==0){
                for(int j=(2*(i+1))-1;j<n;j=j+i+1){
                    arr[j]=1;
                }
            }
        }
        return arr;
    }
    public static int[][] floydWarshall(int graph[][],int V){ 
        int dist[][] = new int[V][V]; 
        int i, j, k; 
        for (i = 0; i < V; i++){ 
            for (j = 0; j < V; j++){
                dist[i][j] = graph[i][j]; 
            }
        }
        for (k = 0; k < V; k++) { 
            for (i = 0; i < V; i++){ 
                for (j = 0; j < V; j++){ 
                    if (dist[i][k] + dist[k][j] < dist[i][j]){ 
                        dist[i][j] = dist[i][k] + dist[k][j]; 
                    }
                } 
            } 
        }
        return dist;
    } 
    public static class Comp implements Comparator<pair>{
        public int compare(pair a,pair b){
            if(a.x!=b.x){
                return a.x-b.x;
            }else{
                return a.y-b.y;
            }
        }
    }
    public static int gcd(int a,int b){
        if (b == 0) 
        return a; 
        return gcd(b, a % b);
    }
    public static int lcm(int a,int b){
        int x=Math.max(a,b);
        int y=Math.min(a,b);
        long ans=x;
        while(ans%y!=0){
            ans+=x;
        }
        if(ans>Integer.MAX_VALUE){
            return -1;
        }
        return (int)ans;
    }
    public static long fact(int n){
        long ans=1;
        for(int i=1;i<=n;i++){
            ans*=i;
        }
        return ans;
    }
}