#include <stdio.h>
int main(void){
    int b[100],n;
    double a[100],c[100];
        scanf("%d",&n);
        for(b[2]=1;b[2]<=n;b[2]++){
            for(b[3]=1;b[3]<=8;b[3]++){
                scanf("%lf",&a[b[3]+10*n]);
            }
        }


for(b[2]=1;b[2]<=n;b[2]++){
        c[0]*1.0=a[6+10*n]/a[7+10*n]*1.0;
        c[1]*1.0=a[2+10*n]/a[3+10*n]*1.0;
        if(c[0]==c[1]){
            printf("YES\n");
        }
        else printf("NO\n");
            }




    return 0;
}