#include <iostream>
using namespace std;
#define r 100000

int main() {
	int N;
	double x[4],y[4];
	cin>>N;
	while(N--){
		for(int i=0;i<4;i++) cin>>x[i]>>y[i];
		for(int i=0;i<4;i++){ 
			x[i]*=r; y[i]*=r;
		}
		double a1=(y[1]-y[0])/(x[1]-x[0]);
		double a2=(y[3]-y[2])/(x[3]-x[2]);
		if(a1==a2) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
		cout<<a1<<" "<<a2;
	}
	return 0;
}