#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <fstream>

using namespace std;

const long double eps = 1e-7;
const long double pi2 = 3.141592653589793238 / 2; 

struct point
{
	long double x, y;
};

long double polar(point a)
{
	return atan2(a.x*a.x+a.y*a.y, 0);
}

int main()
{
	freopen("cake.in", "r", stdin);
	freopen("cake.out", "w", stdout);
	vector<long double> a;
	long double r;
	cin >> r;
	for (int i = 0; i < 4; i++)
	{
		point t;
		cin >> t.x >> t.y;
		a.push_back(polar(t));
	}
	sort(a.begin(), a.end());
	vector<long double> b;
	for (long double alp = 1e-10; alp <= pi2; alp += eps*10)
	{
		b.clear();
		for (int i = 0; i < 4; i++)
		{
			b.push_back(a[i]);
			b.push_back(i * pi2);
		}
		bool f = true;
		for (int i = 0; i < 4; i++)
		{
			for (int j = 1; j < 8; j+=2)
				if (abs(a[i] - b[j]) < eps)
					f = false;
		}
		if (!f) continue;
		sort(b.begin(), b.end());
		f = true;
		if (abs(a[0] - b[0]) < eps)
		{
			for (int i = 1; i < 4; i++)
			{
				if (!(abs(a[i] - b[2 * i]) < eps))

					f = false;
			}
			if (f)
			{
				cout << "YES";
				return 0;
			}
		}
		f = true;
		if (abs(a[0] - b[1]) < eps)
		{
			for (int i = 1; i < 4; i++)
			{
				if (!(abs(a[i] - b[2 * i + 1]) < eps))
					f = false;
			}
			if (f)
			{
				cout << "YES";
				return 0;
			}
		}
	};
	cout << "NO";
	return 0;
};