import java.io.*;
import java.util.*;

public class cake_pk_wa {
	public static void main(String[] args) {
		new cake_pk_wa().run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	long R;

	class Point implements Comparable<Point> {
		long x, y;
		double sin, rad;

		Point(long X, long Y) {
			x = X;
			y = Y;
			assert (X * X + Y * Y < R * R);
			sin = y / (Math.sqrt(x * x + y * y));
			rad = Math.asin(sin);
			if (x < 0)
				rad = Math.PI - rad;
			if (rad < 0)
				rad += Math.PI * 2;
		}

		@Override
		public int compareTo(Point t) {
			if (rad < t.rad - 1e-6)
				return -1;
			if (rad > t.rad + 1e-6)
				return 1;
			return 0;
		}

		public int get(double a) {
			int ans = 0;
			double r = rad;
			while (r > a + 1e-6) {
				r -= Math.PI / 2;
				ans++;
			}
			ans %= 4;
			if (r < a - 1e-6)
				return ans;
			else
				return -1;
		}
	}

	public void solve() throws IOException {
		R = nextInt();
		assert ((1 <= R) && (R <= 1e9));
		Point[] a = new Point[4];
		for (int i = 0; i < 4; i++)
			a[i] = new Point(nextInt(), nextInt());
		Arrays.sort(a);
		for (int i = 0; i < 4; i++) {
			double x = a[i].rad;
			double y = a[(i + 1) % 4].rad;
			if (x > y)
				x += Math.PI * 2;
			if (y - x > Math.PI + 1e-6) {
				out.println("NO");
			}
		}
		out.println("YES");
	}

	public void run() {
		try {
			br = new BufferedReader(new FileReader("cake.in"));
			out = new PrintWriter("cake.out");
			// br = new BufferedReader(new InputStreamReader(System.in));
			// out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}