#include <iostream>                                                                      |#include <iostream>
using namespace std;                                                                     |#include <stdio.h>
                                                                                         |#include <math.h>
int main() {                                                                             |using namespace std;
  double x1,y1,x2,y2,x3,y3,xp,yp;                                                        |
  double a[2],b[2];                                                                      |int main() {
  double A,B;                                                                            |  double a, b, c, d, e, f;
  while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {                           |  double x, y;
    a[0] = x2 - x1;                                                                      |  while( cin >> a >> b >> c >> d >> e >> f) {
    a[1] = y2- y1;                                                                       |x = (c * e - b * f) / (a * e - b * d);
    b[0] = x3 - x1;                                                                      |    y = (a * f - c * d) / (a * e - b * d);
    b[1] = y3 - y1;                                                                      |    x *= 1000;
    //vect[0] = A * a[0] + B * b[0];                                                     |    x += 0.5;
    //vect[1] = A * a[1] + B * b[1];                                                     |    x = floor(x);
    A = (xp * b[1] - b[0] * yp) / (a[0] * b[1] - b[0] * a[1]);                           |    x /= 1000;
    B = (a[0] * yp - xp * a[1]) / (a[0] * b[1] - b[0] * a[1]);                           |    y *= 1000;
    if ((A+B <= 1) && (A > 0) && (B > 0)) {                                              |    y += 0.5;
      cout << "YES" << endl;                                                             |    y = floor(y);
    }                                                                                    |    y /= 1000;
    else {                                                                               |
      cout << "NO" << endl;                                                              |    printf("%.3f %.3f\n", x, y);
    }                                                                                    |
  }                                                                                      |  }
}       