You are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect.The interior of the square is considered to be part of the square, i.e. if one square is completely inside another, they intersect. If the two squares only share one common point, they are also considered to intersect.

The input data consists of two lines, one for each square, both containing 4 pairs of integers. Each pair represents coordinates of one vertex of the square. Coordinates within each line are either in clockwise or counterclockwise order. The first line contains the coordinates of the square with sides parallel to the coordinate axes, the second line contains the coordinates of the square at 45 degrees. All the values are integer and between $$$-100$$$ and $$$100$$$.

Print "Yes" if squares intersect, otherwise print "No". You can print each letter in any case (upper or lower).

NoteIn the first example the second square lies entirely within the first square, so they do intersect.In the second sample squares do not have any points in common.Here are images corresponding to the samples:

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

public class TwoSquaresA {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

		int a1 = 1000;
		int a2 = -1000;
		int b1 = 1000;
		int b2 = -1000;
		int a3 = 1000;
		int a4 = -1000;
		int b3 = 1000;
		int b4 = -1000;
		for (int i = 0; i < 4; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			a1 = Math.min(a1, a);
			a2 = Math.max(a2, a);
			b1 = Math.min(b1, b);
			b2 = Math.max(b2, b);
		}
		for (int i = 0; i < 4; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			a3 = Math.min(a3, a+b);
			a4 = Math.max(a4, a+b);
			b3 = Math.min(b3, a-b);
			b4 = Math.max(b4, a-b);
		}
		for (int i = a1; i <= a2; i++) {
			for (int j = b1; j <= b2; j++) {
				if (i+j>=a3&&i+j<=a4&&i-j>=b3&&i-j<=b4) {
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;

public class C {
    public static void main(String args[])
    {
        FastReader Reader=new FastReader(System.in);
        int arr1[][]=new int[4][2];
        int arr2[][]=new int[4][2];
        for(int i=0;i<4;i++)
        {
            arr1[i][0]=Reader.nextInt();
            arr1[i][1]=Reader.nextInt();
        }
        for(int i=0;i<4;i++)
        {
            arr2[i][0]=Reader.nextInt();
            arr2[i][1]=Reader.nextInt();
        }
        sorts1(arr1,4);
        sorts2(arr2,4);
        /*for(int i=0;i<4;i++)
        {
            System.out.println(arr1[i][0]+" "+arr1[i][1]);
        }
        for(int i=0;i<4;i++)
        {
            System.out.println(arr2[i][0]+" "+arr2[i][1]);
        }*/
        boolean flag=false;
        if(flag==true)
        {
            System.out.println("Yes");
        }
        else
        {
            for(int i=0;i<=2;i=i+2)
            {
                int c = arr2[i][0] + arr2[i][1];
                for(int j=0;j<=2;j+=2)
                {
                    int x=arr1[j][0];
                    int y=c-x;
                    if(y>=arr1[j][1]&&y<=arr1[j+1][1])
                    {
                        if(x>=arr2[i+1][0] && x<=arr2[i][0] && y>=arr2[i][1]&& y<=arr2[i+1][1])
                        {
                            flag=true;
                            break;
                        }
                    }
                }
                if(flag==true)
                    break;
                for(int j=0;j<=1;j+=1)
                {
                    int y=arr1[j][1];
                    int x=c-y;
                    if(x>=arr1[j][0]&&x<=arr1[j+2][0])
                    {
                        if(x>=arr2[i+1][0] && x<=arr2[i][0] && y>=arr2[i][1]&& y<=arr2[i+1][1])
                        {
                            flag=true;
                            break;
                        }
                    }
                }
                if(flag==true)
                    break;

            }
            if(flag==true)
            {
                System.out.println("Yes");
            }
            else
            {
                for(int i=0;i<=1;i=i+1)
                {
                    int c = arr2[i][1] - arr2[i][0];
                    for(int j=0;j<=2;j+=2)
                    {
                        int x=arr1[j][0];
                        int y=c+x;
                        if(y>=arr1[j][1]&&y<=arr1[j+1][1])
                        {
                            if(x>=arr2[i][0] && x<=arr2[i+2][0] && y>=arr2[i][1]&& y<=arr2[i+2][1])
                            {
                                flag=true;
                                break;
                            }
                        }
                    }
                    if(flag==true)
                        break;
                    for(int j=0;j<=1;j+=1)
                    {
                        int y=arr1[j][1];
                        int x=y-c;
                        if(x>=arr1[j][0]&&x<=arr1[j+2][0])
                        {
                            if(x>=arr2[i][0] && x<=arr2[i+2][0] && y>=arr2[i][1]&& y<=arr2[i+2][1])
                            {
                                flag=true;
                                break;
                            }
                        }
                    }
                    if(flag==true)
                        break;

                }
                if(flag==true)
                {
                    System.out.println("Yes");
                }
                else
                {
                    int lowx=arr1[0][0];
                    int highx=arr1[2][0];
                    int lowy=arr1[0][1];
                    int highy=arr1[1][1];
                    boolean flag2=true;
                    for(int j=0;j<4;j++)
                    {
                        if(arr2[j][0]>=lowx && arr2[j][0]<=highx && arr2[j][1]>=lowy && arr2[j][1]<=highy)
                        {
                            flag2=true;
                        }
                        else
                        {
                            flag2=false;
                            break;
                        }
                    }
                    if(flag2==true)
                    {
                        System.out.println("Yes");
                    }
                    else
                    {
                        double lowwx=(arr2[0][0]+arr2[1][0])/2.0;
                        double highhx=(arr2[0][0]+arr2[2][0])/2.0;
                        double lowwy=(arr2[0][1]+arr2[1][1])/2.0;
                        double highhy=(arr2[1][1]+arr2[3][1])/2.0;
                        flag2=true;
                        for(int j=0;j<4;j++)
                        {
                            if(arr1[j][0]>=lowwx && arr1[j][0]<=highhx && arr1[j][1]>=lowwy && arr1[j][1]<=highhy)
                            {
                                flag2=true;
                            }
                            else
                            {
                                flag2=false;
                                break;
                            }
                        }
                        if(flag2==true)
                        {
                            System.out.println("Yes");
                        }
                        else
                        {
                            System.out.println("No");
                        }
                    }
                }
            }
        }

    }
    public static void sorts1(int arr[][],int N)
    {
        Integer arr_obj[][]=new Integer[N][2];
        for(int i=0; i<N; ++i){
            arr_obj[i][0] = new Integer(arr[i][0]);
            arr_obj[i][1] = new Integer(arr[i][1]);
        }
        /*Arrays.sort(arr_obj, new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                return o2[1]-o1[1];
            }
        });*/
        Arrays.sort(arr_obj, new Comparator<Integer[]>() {
            @Override
            public int compare(Integer[] o1, Integer[] o2) {
               if(o1[0]-o2[0]!=0)
                   return o1[0]-o2[0];
               else
                   return o1[1]-o2[1];
            }
        });
        for(int i=0; i<N; ++i){
            arr[i][0] = arr_obj[i][0];
            arr[i][1] =arr_obj[i][1];
        }
    }
    public static void sorts2(int arr[][],int N)
    {
        Integer arr_obj[][]=new Integer[N][2];
        for(int i=0; i<N; ++i){
            arr_obj[i][0] = new Integer(arr[i][0]);
            arr_obj[i][1] = new Integer(arr[i][1]);
        }
        /*Arrays.sort(arr_obj, new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                return o2[1]-o1[1];
            }
        });*/
        Arrays.sort(arr_obj, new Comparator<Integer[]>() {
            @Override
            public int compare(Integer[] o1, Integer[] o2) {
                if(o1[1]-o2[1]!=0)
                    return o1[1]-o2[1];
                else
                    return o1[0]-o2[0];
            }
        });
        for(int i=0; i<N; ++i){
            arr[i][0] = arr_obj[i][0];
            arr[i][1] =arr_obj[i][1];
        }
    }
}
class FastReader {
    private InputStream stream;
    private byte[] buf = new byte[8192];
    private int curChar;
    private int pnumChars;
    private FastReader.SpaceCharFilter filter;

    public FastReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (pnumChars == -1) {
            throw new InputMismatchException();
        }
        if (curChar >= pnumChars) {
            curChar = 0;
            try {
                pnumChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (pnumChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }

    public String next() {
        return nextString();
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c == ',') {
                c = read();
            }
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public String nextLine() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }

    public boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null) {
            return filter.isSpaceChar(c);
        }
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);

    }

}

import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Locale;

public class c
{
    private static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    static String readln() throws IOException
    {
        String line = input.readLine();
        return line;
    }

    public static void main(String[] args) throws IOException
    {
        Locale.setDefault(Locale.US);
        String input = c.readln();
        String[] entries = input.split("\\s+");

        square s = new square(entries);

        Rectangle r = new Rectangle(s.minx, s.miny, s.maxx - s.minx, s.maxy - s.miny);

        // For our next one, make a line between all the points.
        input = c.readln();
        entries = input.split("\\s+");

        ArrayList<point> points = new ArrayList<>();
        for(int i = 0; i < 8; i+=2){
            int x = Integer.parseInt(entries[i]);
            int y = Integer.parseInt(entries[i + 1]);
            points.add(new point(x, y));
        }

        for(point p : points){
            for(point p2: points){
                if(r.intersectsLine(p.x, p.y, p2.x, p2.y)){
                    System.out.println("YES");
                    return;
                }
                /*
                if(p.x == p2.x){
                    continue;
                }
                if(p.y == p2.y){
                    continue;
                }

                // go downwards
                if(p.y > p2.y && p.x > p2.x) {
                    int diff = p.x - p2.x;
                    for(int i = 0; i <= diff; i++ ) {
                        int x = p.x - i;
                        int y = p.y - i;
                        if(s.isInSquare(x, y)){
                            System.out.println("YES");
                            return;
                        }
                    }
                }

                if(p.y > p2.y && p.x < p2.x) {
                    int diff = p2.x - p.x;
                    for(int i = 0; i <= diff; i++ ) {
                        int x = p.x + i;
                        int y = p.y - i;
                        if(s.isInSquare(x, y)){
                            System.out.println("YES");
                            return;
                        }
                    }
                }
                */
            }
        }

        System.out.println("NO");
        return;
    }

    private static class point {
        int x;
        int y;

        public point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    private static class square {
        int minx = Integer.MAX_VALUE;
        int maxx = Integer.MIN_VALUE;
        int miny = Integer.MAX_VALUE;
        int maxy = Integer.MIN_VALUE;

        public square(String[] construction) {
            for(int i = 0; i < 8; i+=2){
                int x = Integer.parseInt(construction[i]);
                int y = Integer.parseInt(construction[i + 1]);
                this.minx = Math.min(x, minx);
                this.maxx = Math.max(x, maxx);
                this.miny = Math.min(y, miny);
                this.maxy = Math.max(y, maxy);
            }
        }

        boolean isInSquare(int x, int y){
            if(x < minx){
                return false;
            }

            if(x > maxx){
                return false;
            }

            if(y < miny) {
                return false;
            }

            if(y > maxy){
                return false;
            }

            return true;
        }
    }

}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;

public class R488C {
    static int maxx1 = Integer.MIN_VALUE, maxy1 = Integer.MIN_VALUE, minx1 = Integer.MAX_VALUE, miny1 = Integer.MAX_VALUE , maxx2 = Integer.MIN_VALUE, maxy2 = Integer.MIN_VALUE, minx2 = Integer.MAX_VALUE , miny2 = Integer.MAX_VALUE;
    public static void main (String[] args) throws java.lang.Exception {

        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int[] a = in.nextIntArray(8), b = in.nextIntArray(8);
        for (int i = 0; i < 8; i++) {
            if (i % 2 == 0) {
                maxx1 = Math.max(maxx1, a[i]);
                minx1 = Math.min(minx1, a[i]);

                maxx2 = Math.max(maxx2, b[i]);
                minx2 = Math.min(minx2, b[i]);
            } else {
                maxy1 = Math.max(maxy1, a[i]);
                miny1 = Math.min(miny1, a[i]);

                maxy2 = Math.max(maxy2, b[i]);
                miny2 = Math.min(miny2, b[i]);
            }
        }
        for (int i = -100; i <= 100; i++) {
            for (int j = -100; j <= 100; j++) {
                if (isInside1(i, j) && isInside2(i, j)) {
                    w.println("YES");
                    w.close();
                    return;
                }
            }
        }
        w.println("NO");
        w.close();
    }
    static boolean isInside1(int x, int y) {
        return (x <= maxx1 && x >= minx1 && y >= miny1 && y <= maxy1);
    }
    static boolean isInside2(int x, int y) {
        if (x < minx2 || x > maxx2)
            return false;
        double dif = Math.abs(x - (maxx2 + minx2) / 2.0);
        return (y >= miny2 + dif && y <= maxy2 - dif);
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Main
{
    static long mod=1000000007;
    public static void main(String[] args) throws Exception
    {
    	FastReader in=new FastReader();
    	PrintWriter pw=new PrintWriter(System.out);
    	int axmax=-101,axmin=101,aymax=-101,aymin=101;
    	int bxmax=-101,bxmin=101,bymax=-101,bymin=101;
    	int[][] c=new int[8][2];
    	for(int i=0;i<8;i++)
    	{
    		int x=in.nextInt();
    		int y=in.nextInt();
    		if(i>3)
    		{
    			c[i][0]=x-y;
    			c[i][1]=x+y;
    		}
    		else
    		{
    			c[i][0]=x;
    			c[i][1]=y;
    		}
    	}
    	for(int i=0;i<4;i++)
    	{
			axmin=Math.min(axmin,c[i][0]);
			axmax=Math.max(axmax,c[i][0]);
			aymin=Math.min(aymin,c[i][1]);
			aymax=Math.max(aymax,c[i][1]);
    	}
    	for(int i=4;i<8;i++)
    	{
			bxmin=Math.min(bxmin,c[i][0]);
			bxmax=Math.max(bxmax,c[i][0]);
			bymin=Math.min(bymin,c[i][1]);
			bymax=Math.max(bymax,c[i][1]);
    	}
    	String ans="NO";
    	for(int x=axmin;x<=axmax;x++)
    	{
    		for(int y=aymin;y<=aymax;y++)
    		{
    			if(bxmin<=x-y && x-y<=bxmax && bymin<=x+y && x+y<=bymax)
    				ans="YES";
    		}
    	}
    	pw.print(ans);
    	pw.flush();
    }

    public static long inverse(long a)
    {
    	long r=1,p=mod-2;
    	while(p>0)
    	{
    		if(p%2==1)
    		{
    			r*=a;
    			r%=mod;
    		}
    		p>>=1;
    		a=(a*a)%mod;
    	}

    	return r;
    }

}

class pair<A,B>
{
    A f;
    B s;

    public pair(A a,B b)
    {
        f=a;
        s=b;
    }
}

class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        br=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next() throws IOException
    {
        if(st==null || !st.hasMoreElements())
        {
            st=new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

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

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

import java.util.Arrays;
import java.util.Scanner;

public class C {

	static class Point {
		int x;
		int y;

		public Point(int xx, int yy) {
			x = xx;
			y = yy;
		}
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Point[] a = new Point[4];
		for(int i = 0; i < 4; ++i) a[i] = new Point(in.nextInt(), in.nextInt());

		Point[] b = new Point[4];
		for(int i = 0; i < 4; ++i) b[i] = new Point(in.nextInt(), in.nextInt());
		in.close();

		if(check(a,b)) {
			System.out.println("YES");
		}
		else System.out.println("NO");

	}

	static boolean check(Point[] a, Point[] b) {

		for(int i = 0; i < 4; ++i) {
			for(int j = 0; j < 4; ++j) {
				if(intersect(a[i], a[(i+1)%4], b[j], b[(j+1)%4])) {
//					System.out.println("i = " + i + " j  = " + j);
//					System.out.println("From (" + a[i].x + ", " + a[i].y +") to (" + a[(i+1)%4].x + ", " + a[(i+1)%4].y +")");
//					System.out.println("From (" + b[j].x + ", " + b[j].y +") to (" + b[(j+1)%4].x + ", " + b[(j+1)%4].y +")");
					return true;
				}
			}
		}

		for(int i = 0; i < 4; ++i) {
			if(isInside(a, b[i])) {
		//		System.out.println("i = " + i);
				return true;
			}
		}

		for(int i = 0; i < 4; ++i) {
			if(isInside(b, a[i])) return true;
		}
		return false;
	}

	static boolean isInside(Point[] polygon, Point p)
	{
	    // There must be at least 3 vertices in polygon[]
	    if (polygon.length < 3)  return false;

	    // Create a point for line segment from p to infinite
	    Point extreme = new Point(10000, p.y);

	    // Count intersections of the above line with sides of polygon
	    int count = 0, i = 0;
	    do
	    {
	        int next = (i+1)%polygon.length;

	        // Check if the line segment from 'p' to 'extreme' intersects
	        // with the line segment from 'polygon[i]' to 'polygon[next]'
	        if (intersect(polygon[i], polygon[next], p, extreme))
	        {
	            // If the point 'p' is colinear with line segment 'i-next',
	            // then check if it lies on segment. If it lies, return true,
	            // otherwise false
	            if (direction(polygon[i], p, polygon[next]) == 0) {
	               return onSegment(polygon[i], polygon[next], p);
	            }

	            count++;
	        }
	        i = next;
	    } while (i != 0);

	    // Return true if count is odd, false otherwise
	    return (count%2 == 1);
	}

	public static boolean intersect(Point p1, Point p2, Point p3, Point p4) {
		int d1 = direction(p3, p4, p1); // p3p4, p3p1
		int d2 = direction(p3, p4, p2);
		int d3 = direction(p1, p2, p3);
		int d4 = direction(p1, p2, p4);
		if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0))) {
//			System.out.println("Here1");
			return true;
		}
		else if (d1 == 0 && onSegment(p3, p4, p1)) {
//			System.out.println("Here2");
			return true;
		}
		else if (d2 == 0 && onSegment(p3, p4, p2)) {
//			System.out.println("Here3");
			return true;
		}
		else if (d3 == 0 && onSegment(p1, p2, p3)) {
//			System.out.println("Here4");
			return true;
		}
		else if (d4 == 0 && onSegment(p1, p2, p4)) {
//			System.out.println("Here5");
			return true;
		}
		return false;
	}

	public static int direction(Point p1, Point p2, Point p3) {
		return (p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y);
	}

	public static boolean onSegment(Point p1, Point p2, Point p3) {
		return Math.min(p1.x, p2.x) <= p3.x && p3.x <= Math.max(p1.x, p2.x) && Math.min(p1.y, p2.y) <= p3.y
				&& p3.y <= Math.max(p1.y, p2.y);
	}

}

import java.awt.Polygon;
import java.awt.geom.Line2D;
import java.util.Scanner;

public class cf {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int[][] x = new int[2][4];
		int[][] y = new int[2][4];
		for(int i = 0; i<2; i++) {
			for(int j = 0; j<4; j++) {
				x[i][j] = in.nextInt();
				y[i][j] = in.nextInt();
			}
		}
		Polygon a = new Polygon();
		Polygon b = new Polygon();
		for(int i = 0; i<4; i++) {
			a.addPoint(x[0][i], y[0][i]);
			b.addPoint(x[1][i], y[1][i]);
		}
		boolean ans = false;
		for(int i = 0; i<4; i++) {
			ans |= a.contains(x[1][i],y[1][i]);
			ans |= b.contains(x[0][i],y[0][i]);
		}
		for(int i = 0; i<4; i++) {
			for(int j = 0; j<4; j++) {
				int nxti = (i+1)%4;
				int nxtj = (j+1)%4;
				ans |= Line2D.linesIntersect(x[0][i], y[0][i], x[0][nxti], y[0][nxti], x[1][j], y[1][j], x[1][nxtj], y[1][nxtj]);
				ans |= Line2D.ptSegDist(x[0][i], y[0][i], x[0][nxti], y[0][nxti], x[1][j], y[1][j])<1e-7;
				ans |= Line2D.ptSegDist(x[1][j], y[1][j], x[1][nxtj], y[1][nxtj], x[0][i], y[0][i])<1e-7;
			}
		}
		System.out.println(ans?"YES":"NO");
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
public class main {
	InputStream is;
	PrintWriter out;
	static long mod=pow(10,9)+7;
	int dx[]= {0,0,1,-1},dy[]={+1,-1,0,0};
	class Point{
		int x,y;
		Point(int x,int y){
			this.x=x;
			this.y=y;
		}
	}
	void solve()
	{
		Point[] p=new Point[4];
		for(int i=0;i<4;i++)
			p[i]=new Point(ni(),ni());
		Point[] q=new Point[4];
		for(int i=0;i<4;i++)
			q[i]=new Point(ni(),ni());
		for(int i=0;i<4;i++)
		{
			for(int j=0;j<4;j++)
			{
				if(doIntersect(p[i],p[(i+1)%4],q[j],q[(j+1)%4]))
				{
					out.println("YES");
					return;
				}
			}
		}
		if(check(p[0].x,p[0].y,p[1].x,p[1].y,p[2].x,p[2].y,p[3].x,p[3].y,q[0].x,q[0].y))
		{
			out.println("YES");
			return;
		}
		if(check(q[0].x,q[0].y,q[1].x,q[1].y,q[2].x,q[2].y,q[3].x,q[3].y,p[0].x,p[0].y))
		{
			out.println("YES");
			return;
		}
		out.println("NO");

	}
	static double area(int x1, int y1, int x2,
            int y2, int x3, int y3)
{
return (double)Math.abs((x1 * (y2 - y3) +
x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
}

/* A function to check whether point P(x, y)
lies inside the rectangle formed by A(x1, y1),
B(x2, y2), C(x3, y3) and D(x4, y4) */
static boolean check(int x1, int y1, int x2, int y2,
int x3, int y3, int x4, int y4, int x, int y)
{

/* Calculate area of rectangle ABCD */
double A = area(x1, y1, x2, y2, x3, y3)+
    area(x1, y1, x4, y4, x3, y3);

/* Calculate area of triangle PAB */
double A1 = area(x, y, x1, y1, x2, y2);

/* Calculate area of triangle PBC */
double A2 = area(x, y, x2, y2, x3, y3);

/* Calculate area of triangle PCD */
double A3 = area(x, y, x3, y3, x4, y4);

/* Calculate area of triangle PAD */
double A4 = area(x, y, x1, y1, x4, y4);

/* Check if sum of A1, A2, A3 and A4
is same as A */
return (A == A1 + A2 + A3 + A4);
}

boolean onSegment(Point p, Point q, Point r)
{
    if (q.x <= max(p.x, r.x) && q.x >= min(p.x, r.x) &&
        q.y <= max(p.y, r.y) && q.y >= min(p.y, r.y))
       return true;

    return false;
}

// To find orientation of ordered triplet (p, q, r).
// The function returns following values
// 0 --> p, q and r are colinear
// 1 --> Clockwise
// 2 --> Counterclockwise
int orientation(Point p, Point q, Point r)
{
    // See https://www.geeksforgeeks.org/orientation-3-ordered-points/
    // for details of below formula.
    int val = (q.y - p.y) * (r.x - q.x) -
              (q.x - p.x) * (r.y - q.y);

    if (val == 0) return 0;  // colinear

    return (val > 0)? 1: 2; // clock or counterclock wise
}

// The main function that returns true if line segment 'p1q1'
// and 'p2q2' intersect.
boolean doIntersect(Point p1, Point q1, Point p2, Point q2)
{
    // Find the four orientations needed for general and
    // special cases
    int o1 = orientation(p1, q1, p2);
    int o2 = orientation(p1, q1, q2);
    int o3 = orientation(p2, q2, p1);
    int o4 = orientation(p2, q2, q1);

    // General case
    if (o1 != o2 && o3 != o4)
        return true;

    // Special Cases
    // p1, q1 and p2 are colinear and p2 lies on segment p1q1
    if (o1 == 0 && onSegment(p1, p2, q1)) return true;

    // p1, q1 and q2 are colinear and q2 lies on segment p1q1
    if (o2 == 0 && onSegment(p1, q2, q1)) return true;

    // p2, q2 and p1 are colinear and p1 lies on segment p2q2
    if (o3 == 0 && onSegment(p2, p1, q2)) return true;

     // p2, q2 and q1 are colinear and q1 lies on segment p2q2
    if (o4 == 0 && onSegment(p2, q1, q2)) return true;

    return false; // Doesn't fall in any of the above cases
}

	int bsdown(ArrayList<Integer> al,int l) {
		int low=0,high=al.size()-1,ans=-1;
		while(low<=high) {
			int mid=low+(high-low)/2;
			if(al.get(mid)<=l) {
				low=mid+1;
				ans=mid;
			}else
				high=mid-1;
		}
		return ans;
	}
	ArrayList<Integer>al [];
	void take(int n,int m)
	{
		al=new ArrayList[n];
		for(int i=0;i<n;i++)
			al[i]=new ArrayList<Integer>();
		for(int i=0;i<m;i++)
		{
			int x=ni()-1;
			int y=ni()-1;
			al[x].add(y);
			al[y].add(x);

		}
	}
	int arr[][];
	int small[];
	void pre(int n)
	{
		small=new int[n+1];
		for(int i=2;i*i<=n;i++)
		{
			for(int j=i;j*i<=n;j++)
			{
				if(small[i*j]==0)
					small[i*j]=i;
			}
		}
		for(int i=0;i<=n;i++)
		{
			if(small[i]==0)
				small[i]=i;
		}
	}
	public static int count(long x)
	{
		int num=0;
		while(x!=0)
		{
			x=x&(x-1);
			num++;
		}
		return num;
	}
	static long d, x, y;
	void extendedEuclid(long A, long B) {
	    if(B == 0) {
	        d = A;
	        x = 1;
	        y = 0;
	    }
	    else {
	        extendedEuclid(B, A%B);
	        long temp = x;
	        x = y;
	        y = temp - (A/B)*y;
	    }
	}
	long modInverse(long A,long M) //A and M are coprime
	{
	    extendedEuclid(A,M);
	    return (x%M+M)%M;    //x may be negative
	}
	public static void mergeSort(int[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(int arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		int left[] = new int[n1];
		int right[] = new int[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	public static void mergeSort(long[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(long arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		long left[] = new long[n1];
		long right[] = new long[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	 static class Pair implements Comparable<Pair>{

	      long x;
	      long y,k;
	      int i,h;
	      String s;
		Pair (long x,long y,int i){
			this.x=x;
			this.y=y;
			this.i=i;
		}

		public int compareTo(Pair o) {
			return Long.compare(this.x,o.x);
		}
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair)o;
				return p.x == x && p.y == y;
			}
			return false;
		}
		public int hashCode() {
			return new Long(x).hashCode()*31 + new Long(y).hashCode() ;
		}

	        @Override
	        public String toString() {
	            return  "("+x + " " + y +" "+k+" "+i+" )";
	        }

	    }

	    public static boolean isPal(String s){
	        for(int i=0, j=s.length()-1;i<=j;i++,j--){
	                if(s.charAt(i)!=s.charAt(j)) return false;
	        }
	        return true;
	    }
	    public static String rev(String s){
			StringBuilder sb=new StringBuilder(s);
			sb.reverse();
			return sb.toString();
	    }

	    public static long gcd(long x,long y){
		if(x%y==0)
			return y;
		else
			return gcd(y,x%y);
	    }

	    public static int gcd(int x,int y){
	    	if(y==0)
	    		return x;
	    	return gcd(y,x%y);
	    }

	    public static long gcdExtended(long a,long b,long[] x){

	        if(a==0){
	            x[0]=0;
	            x[1]=1;
	            return b;
	        }
	        long[] y=new long[2];
	        long gcd=gcdExtended(b%a, a, y);

	        x[0]=y[1]-(b/a)*y[0];
	        x[1]=y[0];

	        return gcd;
	    }

	    public static int abs(int a,int b){
		return (int)Math.abs(a-b);
	    }

	    public static long abs(long a,long b){
		return (long)Math.abs(a-b);
	    }

	    public static int max(int a,int b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static int min(int a,int b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long max(long a,long b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static long min(long a,long b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long pow(long n,long p,long m){
		 long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    if(result>=m)
		    result%=m;
		    p >>=1;
		    n*=n;
		    if(n>=m)
		    n%=m;
		}
		return result;
	    }

	    public static long pow(long n,long p){
		long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    p >>=1;
		    n*=n;
		}
		return result;
	    }
	    public static void debug(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
	    void run() throws Exception {
			is = System.in;
			out = new PrintWriter(System.out);
			solve();
			out.flush();
		}

	    public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
				public void run() {
					try {
						new main().run();
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}, "1", 1 << 26).start();

		}
	    private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b));
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}

		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}

		private long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nl();
			return a;
		}

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

}

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

public class Main {
    public static void main(String[] args) throws Exception {
        new Solver().run(1);
    }
}

class Solver {

    private BufferedReader reader = null;
    private StringTokenizer st = null;

    private Point[][] points = new Point[4][4];
    private boolean intersectionFound = false;

    public void run(int inputType) throws Exception {
        if (inputType == 0)
            reader = new BufferedReader(new FileReader("input.txt"));
        else
            reader = new BufferedReader(new InputStreamReader(System.in));

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < 4; ++i) {
            points[0][i] = new Point(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < 4; ++i) {
            points[1][i] = new Point(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        for (int i = 0; i < 2; ++i) {
            for (int j = 0; j < 4; ++j) {

                int nextSq = (i + 1) % 2;
                int res1 = crossProductSign(points[nextSq][0], points[nextSq][1], points[i][j]);
                int res2 = crossProductSign(points[nextSq][1], points[nextSq][2], points[i][j]);
                int res3 = crossProductSign(points[nextSq][2], points[nextSq][3], points[i][j]);
                int res4 = crossProductSign(points[nextSq][3], points[nextSq][0], points[i][j]);

                if ((res1 == 0 && inside(points[nextSq][0], points[nextSq][1], points[i][j]))
                        || (res2 == 0 && inside(points[nextSq][1], points[nextSq][2], points[i][j]))
                        || (res3 == 0 && inside(points[nextSq][2], points[nextSq][3], points[i][j]))
                        || (res4 == 0 && inside(points[nextSq][3], points[nextSq][0], points[i][j]))) {

                    intersectionFound = true;
                    break;
                }

                if (res1 == res2 && res2 == res3 && res3 == res4) {
                    intersectionFound = true;
                    break;
                }
            }

            if (intersectionFound)
                break;
        }

        if (!intersectionFound) {

            for (int i = 0; i < 4; ++i) {
                for (int j = 0; j < 4; ++j) {

                    if (linesIntersect(points[0][i], points[0][(i + 1) % 2], points[1][j], points[1][(j + 1) % 2])) {
                        intersectionFound = true;
                        break;
                    }
                }

                if (intersectionFound)
                    break;
            }
        }

        if (intersectionFound)
            System.out.println("YES");
        else
            System.out.println("NO");

        reader.close();
    }

    boolean linesIntersect(Point p1, Point p2, Point p3, Point p4) {

        boolean res1 = crossProductSign(p1, p2, p4) != crossProductSign(p1, p2, p3);
        boolean res2 = crossProductSign(p3, p4, p1) != crossProductSign(p3, p4, p2);

        return res1 && res2;
    }

    boolean inside(Point p1, Point p2, Point p3) {
        int xhigh = Math.max(p2.x, p1.x);
        int xlow = Math.min(p2.x, p1.x);
        int yhigh = Math.max(p2.y, p1.y);
        int ylow = Math.min(p2.y, p1.y);

        return p3.x >= xlow && p3.x <= xhigh && p3.y >= ylow && p3.y <= yhigh;
    }

    int crossProductSign(Point p1, Point p2, Point p3) {
        int res = (p2.x - p1.x) * (p3.y - p1.y) - (p2.y - p1.y) * (p3.x - p1.x);

        if (res < 0)
            return -1;

        if (res > 0)
            return 1;

        return 0;
    }

    class Point {
        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class cf2 {
	static final double EPS = 1e-9;

  public static void main(String[] args) throws IOException {
	 Scanner sc = new Scanner(System.in);

	 //rec
	 int xr1=sc.nextInt(), yr1=sc.nextInt(), xr2=sc.nextInt(),yr2=sc.nextInt();
	 int xr3=sc.nextInt(), yr3=sc.nextInt(), xr4=sc.nextInt(),yr4=sc.nextInt();

	 Point pr1 = new Point(xr1, yr1);
	 Point pr2 = new Point(xr2, yr2);
	 Point pr3 = new Point(xr3, yr3);
	 Point pr4 = new Point(xr4, yr4);

	 LineSegment lr1 = new LineSegment(pr1, pr2);
	 LineSegment lr2 = new LineSegment(pr2, pr3);
	 LineSegment lr3 = new LineSegment(pr3, pr4);
	 LineSegment lr4 = new LineSegment(pr4, pr1);

	 //diamond
	 int xd1=sc.nextInt(), yd1=sc.nextInt(), xd2=sc.nextInt(),yd2=sc.nextInt();
	 int xd3=sc.nextInt(), yd3=sc.nextInt(), xd4=sc.nextInt(),yd4=sc.nextInt();

	 Point p1 = new Point(xd1, yd1);
	 Point p2 = new Point(xd2, yd2);
	 Point p3 = new Point(xd3, yd3);
	 Point p4 = new Point(xd4, yd4);

	 Point [] pt = new Point [5];
	 pt[0]=p1;  pt[1]=p2;  pt[2]=p3;  pt[3]=p4;  pt[4]=p1;
	 Polygon pg = new Polygon(pt);

	 if(pg.inside(pr1)||pg.inside(pr2)||pg.inside(pr3)||pg.inside(pr4)) {
		 System.out.println("YES");
		 return;
	 }

	 LineSegment ld1 = new LineSegment(p1, p2);
	 LineSegment ld2 = new LineSegment(p2, p3);
	 LineSegment ld3 = new LineSegment(p3, p4);
	 LineSegment ld4 = new LineSegment(p4, p1);

	 Rectangle rec = new Rectangle(new Point(Math.min(Math.min(xr3,xr4),Math.min(xr1,xr2)), Math.min(Math.min(yr3,yr4),Math.min(yr1,yr2))),
			 new Point(Math.max(Math.max(xr3,xr4),Math.max(xr1,xr2)), Math.max(Math.max(yr3,yr4),Math.max(yr1,yr2))) );

	 if(rec.contains(p1)||rec.contains(p2)||rec.contains(p3)||rec.contains(p4)) {
		 System.out.println("YES");
	     return;
	 }

	 if(ld1.intersect(lr1)||ld1.intersect(lr3)||ld1.intersect(lr3)||ld1.intersect(lr4)) {
		 System.out.println("YES");
	     return;
	 }

	 if(ld2.intersect(lr1)||ld2.intersect(lr3)||ld2.intersect(lr3)||ld2.intersect(lr4)) {
		 System.out.println("YES");
	     return;
	 }

	 if(ld3.intersect(lr1)||ld3.intersect(lr3)||ld3.intersect(lr3)||ld3.intersect(lr4)) {
		 System.out.println("YES");
	     return;
	 }

	 if(ld4.intersect(lr1)||ld4.intersect(lr3)||ld4.intersect(lr3)||ld4.intersect(lr4)) {
		 System.out.println("YES");
	     return;
	 }

	 System.out.println("NO");

}

  public static class Polygon {
		// Cases to handle: collinear points, polygons with n < 3

		static final double EPS = 1e-9;

		Point[] g; 			//first point = last point, counter-clockwise representation

		Polygon(Point[] o) { g = o; }

		double perimeter()
		{
			double sum = 0.0;
			for(int i = 0; i < g.length - 1; ++i)
				sum += g[i].dist(g[i+1]);
			return sum;
		}

		double area() 		//clockwise/anti-clockwise check, for convex/concave polygons
		{
			double area = 0.0;
			for(int i = 0; i < g.length - 1; ++i)
				area += g[i].x * g[i+1].y - g[i].y * g[i+1].x;
			return Math.abs(area) / 2.0;			//negative value in case of clockwise
		}

		boolean inside(Point p)	//for convex/concave polygons - winding number algorithm
		{
			double sum = 0.0;
			for(int i = 0; i < g.length - 1; ++i)
			{
				double angle = Point.angle(g[i], p, g[i+1]);
				if((Math.abs(angle) < EPS || Math.abs(angle - Math.PI) < EPS) && p.between(g[i], g[i+1]))
					return true;
				if(Point.ccw(p, g[i], g[i+1]))
					sum += angle;
				else
					sum -= angle;
			}

			return Math.abs(2 * Math.PI - Math.abs(sum)) < EPS;		//abs makes it work for clockwise
		}
		/*
		 * Another way if the polygon is convex
		 * 1. Triangulate the poylgon through p
		 * 2. Check if sum areas == poygon area
		 * 3. Handle empty polygon
		 */

		Point centroid()		//center of mass
		{
			double cx = 0.0, cy = 0.0;
			for(int i = 0; i < g.length - 1; i++)
			{
				double x1 = g[i].x, y1 = g[i].y;
				double x2 = g[i+1].x, y2 = g[i+1].y;

				double f = x1 * y2 - x2 * y1;
				cx += (x1 + x2) * f;
				cy += (y1 + y2) * f;
			}
			double area = area();		//remove abs
			cx /= 6.0 * area;
			cy /= 6.0 * area;
			return new Point(cx, cy);
		}
	}

   static class LineSegment {

		Point p, q;

		LineSegment(Point a, Point b) { p = a; q = b; }

		boolean intersect(LineSegment ls)
		{
			Line l1 = new Line(p, q), l2 = new Line(ls.p, ls.q);
			if(l1.parallel(l2))
			{
				if(l1.same(l2))
					return p.between(ls.p, ls.q) || q.between(ls.p, ls.q) || ls.p.between(p, q) || ls.q.between(p, q);
				return false;
			}
			Point c = l1.intersect(l2);
			return c.between(p, q) && c.between(ls.p, ls.q);
		}

	}

   static class Rectangle {

		static final double EPS = 1e-9;

		Point ll, ur;

		Rectangle(Point a, Point b) { ll = a; ur = b; }

		double area() { return (ur.x - ll.x) * (ur.y - ll.y); }

		boolean contains(Point p)
		{
			return p.x <= ur.x + EPS && p.x + EPS >= ll.x && p.y <= ur.y + EPS && p.y + EPS >= ll.y;
		}

		Rectangle intersect(Rectangle r)
		{
			Point ll = new Point(Math.max(this.ll.x, r.ll.x), Math.max(this.ll.y, r.ll.y));
			Point ur = new Point(Math.min(this.ur.x, r.ur.x), Math.min(this.ur.y, r.ur.y));
			if(Math.abs(ur.x - ll.x) > EPS && Math.abs(ur.y - ll.y) > EPS && this.contains(ll) && this.contains(ur) && r.contains(ll) && r.contains(ur))
				return new Rectangle(ll, ur);
			return null;
		}

	}
   static class Line {

		static final double INF = 1e9, EPS = 1e-9;

		double a, b, c;

		Line(Point p, Point q)
		{
			if(Math.abs(p.x - q.x) < EPS) {	a = 1; b = 0; c = -p.x;	}
			else
			{
				a = (p.y - q.y) / (q.x - p.x);
				b = 1.0;
				c = -(a * p.x + p.y);
			}

		}

		Line(Point p, double m) { a = -m; b = 1; c =  -(a * p.x + p.y); }

		boolean parallel(Line l) { return Math.abs(a - l.a) < EPS && Math.abs(b - l.b) < EPS; }

		boolean same(Line l) { return parallel(l) && Math.abs(c - l.c) < EPS; }

		Point intersect(Line l)
		{
			if(parallel(l))
				return null;
			double x = (b * l.c - c * l.b) / (a * l.b - b * l.a);
			double y;
			if(Math.abs(b) < EPS)
				 y = -l.a * x - l.c;
			else
				y = -a * x - c;

			return new Point(x, y);
		}

		Point closestPoint(Point p)
		{
			if(Math.abs(b) < EPS) return new Point(-c, p.y);
			if(Math.abs(a) < EPS) return new Point(p.x, -c);
			return intersect(new Line(p, 1 / a));
		}

	}

   public static class Vector {

		double x, y;

		Vector(double a, double b) { x = a; y = b; }

		Vector(Point a, Point b) { this(b.x - a.x, b.y - a.y); }

		Vector scale(double s) { return new Vector(x * s, y * s); }              //s is a non-negative value

		double dot(Vector v) { return (x * v.x + y * v.y); }

		double cross(Vector v) { return x * v.y - y * v.x; }

		double norm2() { return x * x + y * y; }

		Vector reverse() { return new Vector(-x, -y); }

		Vector normalize()
		{
			double d = Math.sqrt(norm2());
			return scale(1 / d);
		}
	}

   static class Point implements Comparable<Point>{

		static final double EPS = 1e-9;

		double x, y;

		Point(double a, double b) { x = a; y = b; }

		public int compareTo(Point p)
		{
			if(Math.abs(x - p.x) > EPS) return x > p.x ? 1 : -1;
			if(Math.abs(y - p.y) > EPS) return y > p.y ? 1 : -1;
			return 0;
		}
		static double angle(Point a, Point o, Point b)  // angle AOB
		{
			Vector oa = new Vector(o, a), ob = new Vector(o, b);
			return Math.acos(oa.dot(ob) / Math.sqrt(oa.norm2() * ob.norm2()));
		}
		static boolean ccw(Point p, Point q, Point r)
		{
			return new Vector(p, q).cross(new Vector(p, r)) > 0;
		}

		public double dist(Point p) { return Math.sqrt(sq(x - p.x) + sq(y - p.y)); }

		static double sq(double x) { return x * x; }

		Point rotate(double angle)
		{
			double c = Math.cos(angle), s = Math.sin(angle);
			return new Point(x * c - y * s, x * s + y * c);
		}
		// for integer points and rotation by 90 (counterclockwise) : swap x and y, negate x

		boolean between(Point p, Point q)
		{
			return x < Math.max(p.x, q.x) + EPS && x + EPS > Math.min(p.x, q.x)
					&& y < Math.max(p.y, q.y) + EPS && y + EPS > Math.min(p.y, q.y);
		}

		//returns true if it is on the line defined by a and b

		//returns true if it is on the ray whose start point is a and passes through b
		// Another way: find closest point and calculate the distance between it and p
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

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

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public long nextlong() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			long res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}

import java.awt.geom.Line2D;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        ArrayList<Point> square1 = new ArrayList<>();
        ArrayList<Point> square2 = new ArrayList<>();
        StringTokenizer st = new StringTokenizer(in.readLine());
        for (int i = 0; i < 4; i++) {
            int x = Integer.parseInt(st.nextToken());
            int y = Integer.parseInt(st.nextToken());
            square1.add(new Point(x,y));
        }
        st = new StringTokenizer(in.readLine());
        for (int i = 0; i < 4; i++) {
            int x = Integer.parseInt(st.nextToken());
            int y = Integer.parseInt(st.nextToken());
            square2.add(new Point(x,y));
        }
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                Point a1 = square1.get(i);
                Point a2 = square1.get((i+1)%4);
                Point b1 = square2.get(j);
                Point b2 = square2.get((j+1)%4);
                if (Line2D.linesIntersect(a1.x, a1.y, a2.x, a2.y, b1.x, b1.y, b2.x, b2.y)) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                Point a1 = square1.get(i);
                Point b1 = square2.get(j);
                Point b2 = square2.get((j+1)%4);
                if (Line2D.linesIntersect(a1.x, a1.y, a1.x, 200, b1.x, b1.y, b2.x, b2.y)) {
                    for (int k = 0; k < 4; k++) {
                        if (k == j) {
                            continue;
                        }
                        Point c1 = square2.get(k);
                        Point c2 = square2.get((k+1)%4);
                        if (Line2D.linesIntersect(a1.x, a1.y, a1.x, -200, c1.x, c1.y, c2.x, c2.y)) {
                            System.out.println("YES");
                            return;
                        }
                    }
                }
            }
        }
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                Point a1 = square2.get(i);
                Point b1 = square1.get(j);
                Point b2 = square1.get((j+1)%4);
                if (Line2D.linesIntersect(a1.x, a1.y, a1.x, 200, b1.x, b1.y, b2.x, b2.y)) {
                    for (int k = 0; k < 4; k++) {
                        if (k == j) {
                            continue;
                        }
                        Point c1 = square1.get(k);
                        Point c2 = square1.get((k+1)%4);
                        if (Line2D.linesIntersect(a1.x, a1.y, a1.x, -200, c1.x, c1.y, c2.x, c2.y)) {
                            System.out.println("YES");
                            return;
                        }
                    }
                }
            }
        }
        System.out.println("NO");
    }

    static class Point {
        int x, y;
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

}
/*

 */

/**
 * Date: 16 Jun, 2018
 * Link:
 *
 * @author Prasad-Chaudhari
 * @email prasadc8897@gmail.com
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class newProgram5 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        Point a1 = new Point(in.nd(), in.nd());
        Point a2 = new Point(in.nd(), in.nd());
        Point a3 = new Point(in.nd(), in.nd());
        Point a4 = new Point(in.nd(), in.nd());

        Point b1 = new Point(in.nd(), in.nd());
        Point b2 = new Point(in.nd(), in.nd());
        Point b3 = new Point(in.nd(), in.nd());
        Point b4 = new Point(in.nd(), in.nd());

        if (getArea(a1, a2, b1) + getArea(a2, a3, b1) + getArea(a3, a4, b1) + getArea(a4, a1, b1) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
        } else if (getArea(a1, a2, b2) + getArea(a2, a3, b2) + getArea(a3, a4, b2) + getArea(a4, a1, b2) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
        } else if (getArea(a1, a2, b4) + getArea(a2, a3, b4) + getArea(a3, a4, b4) + getArea(a4, a1, b4) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
        } else if (getArea(a1, a2, b3) + getArea(a2, a3, b3) + getArea(a3, a4, b3) + getArea(a4, a1, b3) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
        } else if (getArea(b1, b2, a3) + getArea(b2, b3, a3) + getArea(b3, b4, a3) + getArea(b4, b1, a3) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
        } else if (getArea(b1, b2, a1) + getArea(b2, b3, a1) + getArea(b3, b4, a1) + getArea(b4, b1, a1) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
        } else if (getArea(b1, b2, a2) + getArea(b2, b3, a2) + getArea(b3, b4, a2) + getArea(b4, b1, a2) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
        } else if (getArea(b1, b2, a4) + getArea(b2, b3, a4) + getArea(b3, b4, a4) + getArea(b4, b1, a4) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
        } else if (lineIntersect(a1, a2, b1, b2)) {
            System.out.println("Yes");
        } else if (lineIntersect(a1, a2, b2, b3)) {
            System.out.println("Yes");
        } else if (lineIntersect(a1, a2, b3, b4)) {
            System.out.println("Yes");
        } else if (lineIntersect(a1, a2, b4, b1)) {
            System.out.println("Yes");
        } else if (lineIntersect(a2, a3, b1, b2)) {
            System.out.println("Yes");
        } else if (lineIntersect(a2, a3, b2, b3)) {
            System.out.println("Yes");
        } else if (lineIntersect(a2, a3, b3, b4)) {
            System.out.println("Yes");
        } else if (lineIntersect(a2, a3, b4, b1)) {
            System.out.println("Yes");
        } else if (lineIntersect(a3, a4, b1, b2)) {
            System.out.println("Yes");
        } else if (lineIntersect(a3, a4, b2, b3)) {
            System.out.println("Yes");
        } else if (lineIntersect(a3, a4, b3, b4)) {
            System.out.println("Yes");
        } else if (lineIntersect(a3, a4, b4, b1)) {
            System.out.println("Yes");
        } else if (lineIntersect(a4, a1, b1, b2)) {
            System.out.println("Yes");
        } else if (lineIntersect(a4, a1, b2, b3)) {
            System.out.println("Yes");
        } else if (lineIntersect(a4, a1, b3, b4)) {
            System.out.println("Yes");
        } else if (lineIntersect(a4, a1, b4, b1)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    private static double getArea(Point a, Point b, Point c) {
        double ans = Math.abs(((a.x * (b.y - c.y)) + (b.x * (c.y - a.y)) + (c.x * (a.y - b.y))));
        return ans / 2.0;
    }

    private static boolean lineIntersect(Point a, Point b, Point c, Point d) {
        double ans1 = a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y);
        double ans2 = a.x * (b.y - d.y) + b.x * (d.y - a.y) + d.x * (a.y - b.y);
        double ans3 = c.x * (d.y - a.y) + d.x * (a.y - c.y) + a.x * (c.y - d.y);
        double ans4 = c.x * (d.y - b.y) + d.x * (b.y - c.y) + b.x * (c.y - d.y);
        return ans1 * ans2 <= 0 && ans3 * ans4 <= 0;
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

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

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

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

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
            bw.flush();
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
            bw.flush();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}

class Point {

    double x, y;

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

}

import java.io.BufferedReader;
import java.io.IOError;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer stk = new StringTokenizer(br.readLine());
        Line[][] p = new Line[2][4];
        int[][][] arr = new int[2][4][2];
        int maxX = -10000000;
        int minX = 10000000;
        int maxY = - 10000000;
        int minY = 10000000;
        for(int i=0;i<4;i++){
            int x = Integer.parseInt(stk.nextToken());
            int y = Integer.parseInt(stk.nextToken());
            arr[0][i][0] = x;
            arr[0][i][1] = y;
            maxX = Math.max(maxX,x);
            minX = Math.min(minX,x);
            maxY = Math.max(maxY,y);
            minY = Math.min(minY,y);
        }
        stk = new StringTokenizer(br.readLine());
        for(int i=0;i<4;i++){
            int x = Integer.parseInt(stk.nextToken());
            int y = Integer.parseInt(stk.nextToken());
            arr[1][i][0] = x;
            arr[1][i][1] = y;
        }
        for(int i=0;i<4;i++){
            p[0][i] = new Line(arr[0][i][0],arr[0][i][1],arr[0][(i+1)%4][0],arr[0][(i+1)%4][1]);
        }
        for(int i=0;i<4;i++){
            p[1][i] = new Line(arr[1][i][0],arr[1][i][1],arr[1][(i+1)%4][0],arr[1][(i+1)%4][1]);
        }
        for(int i=0;i<4;i++){
            Line l1 = p[0][i];
            if(l1.x1==l1.x2){
                //vertical
                for(int j=0;j<4;j++){
                    int a = get(p[1][j]);
                    int b = get2(a,p[1][j]);
                    int interSectPoint = a*l1.x1 +b;
                    if(interSectPoint<=Math.max(p[1][j].y1,p[1][j].y2)&&interSectPoint>=Math.min(p[1][j].y1,p[1][j].y2)
                            &&l1.x1>=Math.min(p[1][j].x1,p[1][j].x2) && l1.x1<= Math.max(p[1][j].x1,p[1][j].x2)
                            &&
                            interSectPoint<=Math.max(l1.y1,l1.y2)
                            &&
                            interSectPoint>=Math.min(l1.y1,l1.y2)){
                        System.out.println("YES");
                        //    System.out.println(l1.x1+" "+interSectPoint);
                        return; }
                }
            }
            else{
                for(int j=0;j<4;j++){
                    int a = get(p[1][j]);
                    int b = get2(a,p[1][j]);
                    int interSectPoint = a*(l1.y1-b);
                    //  System.out.println(interSectPoint+" "+l1.y1+" "+p[1][j].x1+" "+p[1][j].y1+" "+p[1][j].x2+" "+p[1][j].y2);
                    if(interSectPoint<=Math.max(p[1][j].x1,p[1][j].x2)
                            &&
                            interSectPoint>=Math.min(p[1][j].x1,p[1][j].x2)
                            &&
                            l1.y1>=Math.min(p[1][j].y1,p[1][j].y2)
                            &&
                            l1.y1<= Math.max(p[1][j].y1,p[1][j].y2)
                            &&
                            interSectPoint<=Math.max(l1.x1,l1.x2)
                            &&
                            interSectPoint>=Math.min(l1.x1,l1.x2)){
                        //  System.out.println(interSectPoint+" "+l1.y1);
                        System.out.println("YES");return; }
                }
            }
        }
        boolean flag = true;
        for(int i=0;i<4;i++){
            if(!(arr[1][i][0]>=minX&&arr[1][i][0]<=maxX&&arr[1][i][1]>=minY&&arr[1][i][1]<=maxY)){
                flag = false;
            }
        }
        if (flag) {
            System.out.println("YES"); return;
        }
        Line leftTop,rightTop,leftBottom,rightBottom;
        leftTop = rightTop = leftBottom = rightBottom = null;
        for(int i=0;i<4;i++){
            Line line = p[1][i];
            int a = get(line);
            int b = get2(a,line);
            if(a>0){
                if(leftTop==null){
                    leftTop = line;
                    rightBottom = line;
                }
                else{
                    if(get2(a,leftTop)<b){
                        rightBottom = leftTop;
                        leftTop = line;
                    }
                    else{
                        rightBottom = line;
                    }
                }
            }
            else{
                if(rightTop==null){
                    rightTop = line;
                    leftBottom = line;
                }
                else{
                    if(get2(a,rightTop)<b){
                        leftBottom = rightTop ;
                        rightTop  = line;
                    }
                    else{
                        leftBottom = line;
                    }
                }
            }
        }
        if(!check(leftBottom,1,arr)){
            System.out.println("NO");
            return;
        }
        if(!check(rightTop,0,arr)){
            System.out.println("NO");
            return;
        }
        if(!check(rightBottom,0,arr)){
            System.out.println("NO");
            return;
        }
        if(!check(leftTop,1,arr)){
            System.out.println("NO");
            return;
        }
        System.out.println("YES");
    }
    static boolean check(Line checkLine,int ccwThresold,int[][][] arr){
        for(int i=0;i<4;i++){
            Point pp =  new Point(checkLine.x1,checkLine.y1);
            Point ppp =  new Point(checkLine.x2,checkLine.y2);
            Point pppp = new Point(arr[0][i][0],arr[0][i][1]);
            if(ccwThresold==1){
                if(ccw(pp,ppp,pppp)>0){
                    return false;
                }
            }
            else{
                if(ccw(pp,ppp,pppp)<0){
                    return false;
                }
            }
        }
        return true;
    }
    static int ccw(Point p1, Point p2, Point p3) {
        long tmp = p1.x * p2.y + p2.x * p3.y + p3.x * p1.y;
        tmp -= (p1.y * p2.x + p2.y * p3.x + p3.y * p1.x);

        if (tmp < 0)
            return -1;
        if (tmp > 0)
            return 1;
        return 0;
    }
    static class Point{
        int x,y;
        public Point(int x,int y){
            this.x =x;
            this.y = y;
        }
    }
    static int get(Line l){
        return (l.y1-l.y2)/(l.x1-l.x2);
    }
    static int get2(int a,Line l){
        return l.y1-(a*l.x1);
    }
    static class Line {
        int x1,y1,x2,y2;
        public Line(int x1,int y1,int x2,int y2){
            this.x1 = x1;
            this.x2 = x2;
            this.y1 = y1;
            this.y2 = y2;
            if(y1>y2){
                this.y2 = y1;
                this.y1 = y2;
                this.x1 = x2;
                this.x2 = x1;
            }
        }
    }
}

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

	public class knights {
		static boolean DEBUG_FLAG = false;
	    int INF = (int)1e9;
	    long MOD = 1000000007;

	    static void debug(String s) {
	        if(DEBUG_FLAG) {
	            System.out.print(s);
	        }
	    }
	    boolean onSegment(point p, point q, point r)
	    {
	        if (q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y)){

	        	return true;
	        }
	        return false;
	    }
	    int orientation(point p, point q, point r)
	    {
	        int val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
	       // System.out.println(val);
	        if (val == 0) return 0;  // colinear
	        return (val > 0)? 1: 2; // clock or counterclock wise
	    }
	    boolean doIntersect(point p1, point q1, point p2, point q2)
	    {
	        // Find the four orientations needed for general and
	        // special cases
	        int o1 = orientation(p1, q1, p2);
	        int o2 = orientation(p1, q1, q2);
	        int o3 = orientation(p2, q2, p1);
	        int o4 = orientation(p2, q2, q1);

	        // General case
	        if (o1 != o2 && o3 != o4)
	            return true;

	        // Special Cases
	        // p1, q1 and p2 are colinear and p2 lies on segment p1q1
	        if (o1 == 0 && onSegment(p1, p2, q1)) return true;

	        // p1, q1 and p2 are colinear and q2 lies on segment p1q1
	        if (o2 == 0 && onSegment(p1, q2, q1)) return true;

	        // p2, q2 and p1 are colinear and p1 lies on segment p2q2
	        if (o3 == 0 && onSegment(p2, p1, q2)) return true;

	         // p2, q2 and q1 are colinear and q1 lies on segment p2q2
	        if (o4 == 0 && onSegment(p2, q1, q2)) return true;

	        return false; // Doesn't fall in any of the above cases
	    }
	    boolean inside(point[] temp,point  p){
	    	point extreme = new point();
	    	extreme.x = 10000;
	    	extreme.y = p.y;
	    	int n = 4;
	    	int count = 0, i = 0;
	    	do
	        {
	            int next = (i+1)%n;
	            if (doIntersect(temp[i], temp[next], p, extreme)){
	            	if (orientation(temp[i], p, temp[next]) == 0)
	                    return onSegment(temp[i], p, temp[next]);
	            	count++;
	            }
	            i = next;
	        }while (i != 0);
	    	if(count % 2 == 1)
	    		return true;
	    	else
	    		return false;

	    }
	    void solve(InputReader in, PrintWriter out) throws IOException {
	    	point[] sqr1 = new point[4];
	    	for(int i = 0;i<4;i++){
	    		sqr1[i] = new point();
	    		sqr1[i].x = in.nextInt();
	    		sqr1[i].y = in.nextInt();
	    	}
	    	point[] sqr2 = new point[4];
	    	for(int i = 0;i<4;i++){
	    		sqr2[i] = new point();
	    		sqr2[i].x = in.nextInt();
	    		sqr2[i].y = in.nextInt();
	    	}
	    	boolean status1 = false,status = false;;
	    	int i ;
	    	for(i = 0;i<4;i++){
	    		status = inside(sqr1,sqr2[i]);
	    		if(status == true)
	    			break;
	    	}
	    	for(i = 0;i<4;i++){
	    		status1 = inside(sqr2,sqr1[i]);
	    		if(status1 == true)
	    			break;
	    	}
	    	point[] mid = new point[4];
	    	for(i = 0;i<3;i++){
	    		mid[i] = new point();
	    		mid[i].x = (sqr1[i].x + sqr1[i+1].x)/2;
	    		mid[i].y = (sqr1[i].y + sqr1[i+1].y)/2;
	    	}
	    	mid[3] = new point();
	    	mid[3].x = (sqr1[3].x + sqr1[0].x)/2;
    		mid[3].y = (sqr1[3].y + sqr1[0].y)/2;
    		boolean status3 = false;
    		for(i = 0;i<4;i++){
	    		status3 = inside(sqr2,mid[i]);
	    		if(status3 == true)
	    			break;
	    	}
	    	if(status == true || status1 == true || status3 == true)
	    		System.out.println("YES");
	    	else
	    		System.out.println("NO");
	    }
	    public static void main(String[] args) throws IOException {
	        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
	            DEBUG_FLAG = true;
	        }
	        InputReader in = new InputReader();
	        PrintWriter out = new PrintWriter(System.out);
	        int t = 1;
	        long start = System.nanoTime();
	        while(t-- >0) {
	            new knights().solve(in, out);
	        }
	        long end = System.nanoTime();
	        debug("\nTime: " + (end-start)/1e6 + " \n\n");
	        out.close();
	    }

	    static class InputReader {
	        static BufferedReader br;
	        static StringTokenizer st;

	        public InputReader() {
	            br = new BufferedReader(new InputStreamReader(System.in));
	        }

	        String next() {
	            while (st == null || !st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine());
	                } catch (IOException e) {
	                    e.printStackTrace();
	                }
	            }
	            return st.nextToken();
	        }

	        int nextInt() {
	            return Integer.parseInt(next());
	        }

	        long nextLong() {
	            return Long.parseLong(next());
	        }

	        double nextDouble() {
	            return Double.parseDouble(next());
	        }
	    }
	}
		class point{
		int x;
		int y;
	}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class CF499B {

    public static float area(int x1, int y1, int x2, int y2, int x3, int y3)
    {
        return (float)Math.abs((x1 * (y2 - y3) +  x2 * (y3 - y1) + x3 * (y1 - y2))/2);
    }

    static boolean check(int x1, int y1, int x2, int y2,  int x3, int y3, int x4, int y4, int x, int y)
    {

        return (area(x1, y1, x2, y2, x3, y3)+ area(x1, y1, x4, y4, x3, y3) == area(x, y, x1, y1, x2, y2) + area(x, y, x2, y2, x3, y3) + area(x, y, x3, y3, x4, y4) + area(x, y, x1, y1, x4, y4));
    }
	public static void main(String[] args) throws IOException {

		BufferedReader re=new BufferedReader(new InputStreamReader(System.in));
		String a[]=re.readLine().split(" ");
		String b[]=re.readLine().split(" ");
		int Ax1=Integer.parseInt(a[0]);
		int Ay1=Integer.parseInt(a[1]);
		int Ax2=Integer.parseInt(a[2]);
		int Ay2=Integer.parseInt(a[3]);
		int Ax3=Integer.parseInt(a[4]);
		int Ay3=Integer.parseInt(a[5]);
		int Ax4=Integer.parseInt(a[6]);
		int Ay4=Integer.parseInt(a[7]);

		int Bx1=Integer.parseInt(b[0]);
		int By1=Integer.parseInt(b[1]);
		int Bx2=Integer.parseInt(b[2]);
		int By2=Integer.parseInt(b[3]);
		int Bx3=Integer.parseInt(b[4]);
		int By3=Integer.parseInt(b[5]);
		int Bx4=Integer.parseInt(b[6]);
		int By4=Integer.parseInt(b[7]);
		boolean flag=false;
		for(int i=-1000;i<=1000;i++)
		{
			for(int j=-1000;j<=1000;j++)
			{
				if(check(Ax1,Ay1,Ax2,Ay2,Ax3,Ay3,Ax4,Ay4,i,j) &&check(Bx1,By1,Bx2,By2,Bx3,By3,Bx4,By4,i,j) )
				{
					System.out.println("YES");
					flag=true;
					break;
				}
				if(flag)
				{
					break;
				}
			}
		}
		if(!flag) {
		System.out.println("NO");
		}
		}
}
class neww implements Comparable<neww>{
	long P;
	long C;
	long i;
	long h;
	long O;
	neww(long P,long C,long i)
	{
		this.P=P;
		this.C=C;
		this.i=i;
		h=-1;
		O=C;
	}
	@Override
	public int compareTo(neww o) {

		if(this.h==-1)
			return (int) (this.P-o.P);
		if(this.h==0)
			return (int) (this.i-o.i);
		return (int) (this.P-o.P);
	}

}

import java.util.*;
public class Main {
	static class node
	{
		int x;
		int y;
	}
	static node a[]=new node[5];
	static node b[]=new node[5];
	static int vis[][]=new int [300][300];
	static class cmp implements Comparator <node>
	{
		public int compare(node a,node b)
		{
			if(a.x-b.x==0)
				return a.y-b.y;
			else
				return a.x-b.x;
		}
	}
 public static void main(String args[])
 {
	 Scanner input=new Scanner(System.in);

         	 for(int i=0;i<4;i++)a[i]=new node();
         	for(int i=0;i<4;i++)
         	{
         		a[i].x=input.nextInt();a[i].y=input.nextInt();
         	}
         	 for(int i=0;i<4;i++)b[i]=new node();
         	 for(int i=0;i<4;i++)
         	 {
         		 b[i].x=input.nextInt();b[i].y=input.nextInt();

         	 }

         Arrays.sort(a,0,4,new cmp());
         	 Arrays.sort(b,0,4,new cmp());
         	 for(int i=a[0].x;i<=a[2].x;i++)
         	 {
         		 for(int j=a[0].y;j<=a[1].y;j++)
         			 vis[i+100][j+100]=1;
         	 }
         	int cnt=0,blag=0;
            for(int i=b[0].x;i<b[1].x;i++,cnt++)
              for(int j=b[0].y-cnt;j<=b[0].y+cnt;j++)
                if(vis[i+100][j+100]==1)
                  blag=1;
            for(int i=b[1].x;i<=b[3].x;i++,cnt--)
              for(int j=b[0].y-cnt;j<=b[0].y+cnt;j++)
                if(vis[i+100][j+100]==1)
                  blag=1;
            if(blag==0)System.out.println("NO");
            else
            	System.out.println("YES");

 }
}

import java.awt.geom.Line2D;
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class C488C
{
	public static void main(String[] args)
	{
		FastScanner in = new FastScanner(System.in);
		int[] x1 = new int[4];
		int[] y1 = new int[4];
		int[] x2 = new int[4];
		int[] y2 = new int[4];
		for (int i = 0; i < 4; i++) {
			x1[i] = in.nextInt();
			y1[i] = in.nextInt();
		}
		for (int i = 0; i < 4; i++) {
			x2[i] = in.nextInt();
			y2[i] = in.nextInt();
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (Line2D.linesIntersect(x1[i], y1[i], x1[(i + 1) % 4], y1[(i + 1) % 4], x2[j], y2[j], x2[(j + 1) % 4], y2[(j + 1) % 4])) {
					System.out.println("YES");
					return;
				}
			}
		}
		int rectMinX = Math.min(Math.min(x1[0], x1[1]), x1[2]);
		int rectMaxX = Math.max(Math.max(x1[0], x1[1]), x1[2]);
		int rectMinY = Math.min(Math.min(y1[0], y1[1]), y1[2]);
		int rectMaxY = Math.max(Math.max(y1[0], y1[1]), y1[2]);
		if (x2[0] >= rectMinX && x2[0] <= rectMaxX && y2[0] >= rectMinY && y2[0] <= rectMaxY) {
			System.out.println("YES");
			return;
		}
		int dMinX = Math.min(Math.min(Math.min(x2[0], x2[1]), x2[2]), x2[3]);
		int dMaxX = Math.max(Math.max(Math.max(x2[0], x2[1]), x2[2]), x2[3]);
		int dMinY = Math.min(Math.min(Math.min(y2[0], y2[1]), y2[2]), y2[3]);
		int dMaxY = Math.max(Math.max(Math.max(y2[0], y2[1]), y2[2]), y2[3]);
		double midX = (dMinX + dMaxX) / 2.0;
		double midY = (dMinY + dMaxY) / 2.0;
		int x = x1[0];
		int y = y1[0];
		if (!above(x, y, dMinX, midY, midX, dMinY))
			System.out.println("NO");
		else if (!above(x, y, midX, dMinY, dMaxX, midY))
			System.out.println("NO");
		else if (above(x, y, dMinX, midY, midX, dMaxY))
			System.out.println("NO");
		else if (above(x, y, midX, dMaxY, dMaxX, midY))
			System.out.println("NO");
		else
			System.out.println("YES");
	}

	public static boolean above(int x, int y, double x1, double y1, double x2, double y2)
	{
		double a = (y2 - y1) / (x2 - x1);
		double b = y1 - a * x1;
		double yHat = a * x + b;
		return y > yHat;
	}

	/**
	 * Source: Matt Fontaine
	 */
	public static class FastScanner
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream)
		{
			this.stream = stream;
		}

		int read()
		{
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c)
		{
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public int nextInt()
		{
			return Integer.parseInt(next());
		}

		public long nextLong()
		{
			return Long.parseLong(next());
		}

		public double nextDouble()
		{
			return Double.parseDouble(next());
		}

		public String next()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

import java.io.*;
import java.math.*;
import java.util.*;
public class Main
{
    static int mod=((int)1e9)+7;//toString
    public static int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}
    public static int pow_mod(int n,int x){if(x==0)return 1;else{if((x&1)==0){return (pow_mod((((n%mod)*(n%mod))%mod),(x/2)));}else{return (((n%mod)*(pow_mod((((n%mod)*(n%mod))%mod),((x-1)/2))%mod)));}}}
    public static int lower_bound(int[]arr,int val){int lo=0;int hi=arr.length-1;while(lo<hi){int mid=lo+((hi-lo+1)/2);if(arr[mid]==val){return mid;}else if(arr[mid]>val){hi=mid-1;}else lo=mid;}if(arr[lo]<=val)return lo;else return -1;}
    public static int upper_bound(int[]arr,int val){int lo=0;int hi=arr.length-1;while(lo<hi){int mid=lo+((hi-lo)/2);if(arr[mid]==val){return mid;}else if(arr[mid]>val){hi=mid;;}else lo=mid+1;}if(arr[lo]>=val)return lo;else return -1;}

    public static double area(int[]a,int[]b,int[]c)
    {
        double ans=(double)(a[0]*(b[1]-c[1]))+(double)(b[0]*(c[1]-a[1]))+(double)(c[0]*(a[1]-b[1]));
        if(ans<0.00)
        ans*=(-1.00);
        return (ans/2.00);
    }

    public static void main (String[] args) throws java.lang.Exception
    {
        Reader sn=new Reader();
        Print p=new Print();
        int[][]first=new int[2][4];
        int[][]second=new int[2][4];
        for(int i=0;i<8;++i){
            first[(i&1)][(i>>1)]=sn.nextInt();
        }
        for(int i=0;i<8;++i){
            second[(i&1)][(i>>1)]=sn.nextInt();
        }
        int flag=0;
        int area_first=((first[0][0]-first[0][1])*(first[0][0]-first[0][1]))+((first[1][0]-first[1][1])*(first[1][0]-first[1][1]));
        int area_second=((second[0][0]-second[0][1])*(second[0][0]-second[0][1]))+((second[1][0]-second[1][1])*(second[1][0]-second[1][1]));
        for(int i=(-100);i<101;++i){
            for(int j=(-100);j<101;++j){
                double from_first=0.00;
                int[]c={i,j};
                int[]a1={first[0][0],first[1][0]};
                int[]b1={first[0][1],first[1][1]};
                from_first+=(area(a1,b1,c));
                int[]a2={first[0][1],first[1][1]};
                int[]b2={first[0][2],first[1][2]};
                from_first+=(area(a2,b2,c));
                int[]a3={first[0][2],first[1][2]};
                int[]b3={first[0][3],first[1][3]};
                from_first+=(area(a3,b3,c));
                int[]a4={first[0][3],first[1][3]};
                int[]b4={first[0][0],first[1][0]};
                from_first+=(area(a4,b4,c));
                double from_second=0.00;
                int[]aa1={second[0][0],second[1][0]};
                int[]bb1={second[0][1],second[1][1]};
                from_second+=(area(aa1,bb1,c));
                int[]aa2={second[0][1],second[1][1]};
                int[]bb2={second[0][2],second[1][2]};
                from_second+=(area(aa2,bb2,c));
                int[]aa3={second[0][2],second[1][2]};
                int[]bb3={second[0][3],second[1][3]};
                from_second+=(area(aa3,bb3,c));
                int[]aa4={second[0][3],second[1][3]};
                int[]bb4={second[0][0],second[1][0]};
                from_second+=(area(aa4,bb4,c));
                /*System.out.println(from_first+" "+area_first);
                System.out.println(from_second+" "+area_second);*/
                if((from_first==((double)area_first)) && (from_second==((double)area_second)))
                flag=1;
            }
        }
        if(flag==1)
        p.printLine("YES");
        else
        p.printLine("NO");
        p.close();
    }
}
class Pair implements Comparable<Pair> {
		int val;
		int in;
		Pair(int a, int b){
			val=a;
	        in=b;
		}
		@Override
		public int compareTo(Pair o) {
			if(val==o.val)
			return Integer.compare(in,o.in);
			else
			return Integer.compare(val,o.val);
		}}
class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public String readWord()throws IOException
        {
		int c = read();
		while (isSpaceChar(c)) c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		}while (!isSpaceChar(c));
		return res.toString();
	    }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
class Print
{
    private final BufferedWriter bw;
    public Print()
    {
        bw=new BufferedWriter(new OutputStreamWriter(System.out));
    }
    public void print(String str)throws IOException
    {
        bw.append(str);
    }
    public void printLine(String str)throws IOException
    {
        print(str);
        bw.append("\n");
    }
    public void close()throws IOException
    {
        bw.close();
    }}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 27);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            ATwoSquares solver = new ATwoSquares();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class ATwoSquares {
        public void solve(int testNumber, FastInput in, FastOutput out) {
            Rect r1 = new Rect();
            Rect r2 = new Rect();
            for (int i = 0; i < 4; i++) {
                r1.update(in.readInt(), in.readInt());
            }
            for (int i = 0; i < 4; i++) {
                r2.update(in.readInt(), in.readInt());
            }

            for (int x = -100; x <= 100; x++) {
                for (int y = -100; y <= 100; y++) {
                    if (contain1(r1, x, y) && contain2(r2, x, y)) {
                        out.println("YES");
                        return;
                    }
                }
            }
            out.println("NO");
        }

        public boolean contain1(Rect rect, int x, int y) {
            return x >= rect.l && x <= rect.r && y >= rect.b && y <= rect.t;
        }

        public boolean contain2(Rect rect, int x, int y) {
            int cx = (rect.l + rect.r) / 2;
            int cy = (rect.b + rect.t) / 2;
            int dist = Math.abs(cx - x) + Math.abs(cy - y);
            return dist <= cx - rect.l;
        }

    }

    static class FastInput {
        private final InputStream is;
        private byte[] buf = new byte[1 << 20];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

    }

    static class Rect {
        int l = 100;
        int r = -100;
        int t = -100;
        int b = 100;

        public void update(int x, int y) {
            l = Math.min(l, x);
            r = Math.max(r, x);
            t = Math.max(t, y);
            b = Math.min(b, y);
        }

    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private StringBuilder cache = new StringBuilder(10 << 20);
        private final Writer os;

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            return this;
        }

        public FastOutput append(String c) {
            cache.append(c);
            return this;
        }

        public FastOutput println(String c) {
            return append(c).println();
        }

        public FastOutput println() {
            cache.append(System.lineSeparator());
            return this;
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }
}

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

public class CoverPoints{

    public static class Point{
        float x;
        float y;
        Point(int x, int y){
            this.x = (float)x;
            this.y = (float)y;
        }
        Point(float x, float y){
            this.x = x;
            this.y = y;
        }
    }

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        Point[] a = new Point[4];
        Point[] b = new Point[4];
        int x = 0, y = 0;
        for (int i = 0; i < 4; i++){
            x = sc.nextInt();
            y = sc.nextInt();
            a[i] = new Point(x, y);
        }
        for (int i = 0; i < 4; i++){
            x = sc.nextInt();
            y = sc.nextInt();
            b[i] = new Point(x, y);
        }
        if(isInside(a, b) || isInside(b, a))
            System.out.println("YES");
        else
            System.out.println("NO");
    }

    public static boolean isInside(Point[] a, Point[] b){
        float tarea=0, rarea=0;
        for (int i = 0; i < 4; i++){
            tarea = 0;
            for (int j = 0; j < 4; j++){
                int k = (j+1)%4;
                tarea += triangle(b[i], a[j], a[k]);
            }
            rarea = recangle(a);
            //System.out.println(tarea+" "+rarea);
            if(rarea == tarea) return true;
        }
        //midpoint
        Point mp = new Point((b[0].x+b[2].x)/2, (b[0].y+b[2].y)/2);
        tarea = 0;
        for (int j = 0; j < 4; j++){
                int k = (j+1)%4;
                tarea += triangle(mp, a[j], a[k]);
        }
        rarea = recangle(a);
        //System.out.println(tarea+" "+rarea);
        if(rarea == tarea) return true;

        return false;
    }

    public static float recangle(Point[] vertex){
        return triangle(vertex[0], vertex[1], vertex[2]) + triangle(vertex[2], vertex[3], vertex[0]);
    }

    public static float triangle(Point a, Point b, Point c){
        return Math.abs((a.x*(b.y - c.y)+ b.x*(c.y - a.y)+ c.x*(a.y - b.y))/2);
    }

    public static class FastScanner{
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(){
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try{
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong(){
            return Long.parseLong(next());
        }

        double nextDouble(){
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try{
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

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

public class A {

    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        Point[] A = new Point[4];
        Point[] B = new Point[4];
        for(int i = 0; i < 4; ++i)
            A[i] = new Point(sc.nextInt(), sc.nextInt());
        for(int i = 0; i < 4; ++i)
            B[i] = new Point(sc.nextInt(), sc.nextInt());

        boolean yes = false;
        main: for(int x = -100; x <= 100; ++x)
            for(int y = -100; y <= 100; ++y) {
                Point p = new Point(x, y);
                if(inside(p, A) && inside(p, B)) {
                    yes = true;
                    break main;
                }
            }

        out.println(yes ? "YES" : "NO");
//        if(inside(A, B) || inside(B, A) || intersect(A, B))
//            out.println("YES");
///        else
//            out.println("NO");
        out.close();
    }

    static boolean inside(Point[] A, Point[] B) {
        for(Point p: A)
            if(inside(p, A))
                return true;
        return false;
    }

    static boolean inside(Point p, Point[] g) {
        int ccw = 0;
        for(int i = 0; i < 4; ++i) {
            int occw = ccw(p, g[i], g[(i + 1)%4]);
            ccw |= occw;
        }
        return Integer.bitCount(ccw) == 1;
    }

    static int ccw(Point p, Point u, Point v) {
        int x1 = v.x - u.x, y1 = v.y - u.y;
        int x2 = p.x - u.x, y2 = p.y - u.y;
        int cross = x1 * y2 - x2 * y1;
        if(cross > 0)
            return 1;
        else if(cross < 0)
            return 2;
        return 0;
    }

    static boolean intersect(Point[] A, Point[] B) {
        return false;
    }

    static class Point {
        int x, y;

        Point(int a, int b) {
            x = a; y = b;
        }

    }

    static class Scanner
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

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

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

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

        public String nextLine() throws IOException {return br.readLine();}

    }
}

import java.awt.Point;
import java.awt.Polygon;
import java.awt.geom.Area;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
public class C994
{
    static class Scanner
    {
        BufferedReader br;
        StringTokenizer tk=new StringTokenizer("");
        public Scanner(InputStream is)
        {
            br=new BufferedReader(new InputStreamReader(is));
        }
        public int nextInt() throws IOException
        {
            if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
                return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
            tk=new StringTokenizer("");
            return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
                return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        public int[] nextIntArray(int n) throws IOException
        {
            int a[]=new int[n];
            for(int i=0;i<n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArray(int n) throws IOException
        {
            long a[]=new long[n];
            for(int i=0;i<n;i++)
                a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
            int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
            long a[]=new long[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextLong();
            return a;
        }

    }

    public static void main(String args[]) throws IOException
    {
        Scanner in=new Scanner(System.in);
        PrintWriter out=new PrintWriter(System.out);
        int x1[]=new int[4];
        int y1[]=new int[4];
        int x2[]=new int[4];
        int y2[]=new int[4];
        for(int i=0;i<4;i++)
        {
            x1[i]=in.nextInt();
            y1[i]=in.nextInt();
        }

        for(int i=0;i<4;i++)
        {
            x2[i]=in.nextInt();
            y2[i]=in.nextInt();
        }
        Polygon p1=new Polygon(x1,y1,4);
        Polygon p2=new Polygon(x2,y2,4);
        Area a=new Area(p1);
        a.intersect(new Area(p2));
        boolean ans=!a.isEmpty();
        for(int i=0;i<4;i++)
        {
            for(int j=0;j<4;j++)
            {
                if(contains(x1[j],y1[j],x1[(j+1)%4],y1[(j+1)%4],x2[i],y2[i]))
                    ans=true;
            }

        }

        for(int i=0;i<4;i++)
        {
            for(int j=0;j<4;j++)
            {
                if(contains(x2[j],y2[j],x2[(j+1)%4],y2[(j+1)%4],x1[i],y1[i]))
                    ans=true;
            }

        }
        if(ans)
            out.println("Yes");
        else
            out.println("No");
        out.close();
    }
    static boolean contains(int x1,int y1,int x2,int y2,int x,int y)
    {
        int minx=Math.min(x1,x2);
        int miny=Math.min(y1,y2);
        int maxx=Math.max(x1,x2);
        int maxy=Math.max(y1,y2);
        if(x>=minx&&x<=maxx&&y>=miny&&y<=maxy)
        {
            if((y1-y)*(x2-x)==(y2-y)*(x1-x))
                return true;
        }
        return false;
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.awt.Polygon;
import java.awt.geom.Line2D;
import java.awt.geom.Area;
import java.io.IOException;
import java.io.InputStreamReader;
import java.awt.geom.Line2D.Double;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            Polygon p = new Polygon();
            boolean val = false, val1 = false;
            Line2D ar[] = new Line2D[4];
            Line2D arr[] = new Line2D[4];
            int a1 = in.ni();
            int b1 = in.ni();
            int a2 = in.ni();
            int b2 = in.ni();
            int a3 = in.ni();
            int b3 = in.ni();
            int a4 = in.ni();
            int b4 = in.ni();
            ar[0] = new Line2D.Double(a1, b1, a2, b2);
            ar[1] = new Line2D.Double(a2, b2, a3, b3);
            ar[2] = new Line2D.Double(a3, b3, a4, b4);
            ar[3] = new Line2D.Double(a4, b4, a1, b1);
            p.addPoint(a1, b1);
            p.addPoint(a2, b2);
            p.addPoint(a3, b3);
            p.addPoint(a4, b4);
            Polygon q = new Polygon();
            int x1 = in.ni();
            int y1 = in.ni();
            int x2 = in.ni();
            int y2 = in.ni();
            int x3 = in.ni();
            int y3 = in.ni();
            int x4 = in.ni();
            int y4 = in.ni();
            arr[0] = new Line2D.Double(x1, y1, x2, y2);
            arr[1] = new Line2D.Double(x2, y2, x3, y3);
            arr[2] = new Line2D.Double(x3, y3, x4, y4);
            arr[3] = new Line2D.Double(x4, y4, x1, y1);
            q.addPoint(x1, y1);
            q.addPoint(x2, y2);
            q.addPoint(x3, y3);
            q.addPoint(x4, y4);

            for (int i = 0; i < 4; ++i) {
                for (int j = 0; j < 4; ++j) {
                    if (ar[i].intersectsLine(arr[j])) val = true;
                }
            }

            Area a = new Area(p);
            Area b = new Area(q);
            a.intersect(b);
            if (!a.isEmpty() || val == true || val1 == true) out.print("YES");
            else out.print("NO");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.*;
public class TwoSquares {
    public static final double EPS = 1e-7;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] sq1X = new int[4];
        int[] sq1Y = new int[4];
        int[] sq2X = new int[4];
        int[] sq2Y = new int[4];
        int[] sq1XC = new int[4];
        int[] sq1YC = new int[4];
        int[] sq2XC = new int[4];
        int[] sq2YC = new int[4];
        for(int i = 0; i < 4; i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            sq1X[i] = x;
            sq1Y[i] = y;
            sq1XC[i] = x;
            sq1YC[i] = y;
        }
        for(int i = 0; i < 4; i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            sq2X[i] = x;
            sq2Y[i] = y;
            sq2XC[i] = x;
            sq2YC[i] = y;
        }
        //print(sq1X);
        ///print(sq1Y);
        //print(sq2X);
        //print(sq2Y);
        Arrays.sort(sq1XC);
        Arrays.sort(sq1YC);
        Arrays.sort(sq2XC);
        Arrays.sort(sq2YC);
        //check 45 deg square in first
        for (int i = 0; i < 4; i++) {
            int x = sq2X[i];
            int y = sq2Y[i];
            if (x >= sq1XC[0] && x <= sq1XC[2] && y>=sq1YC[0] && y<=sq1YC[2]) {
                System.out.println("yES");
                System.exit(0);
            }
        }
        //Check center of 45 square
        double cX = ((double)sq2XC[0]+(double)sq2XC[3])/2;
        double cY = ((double)sq2YC[0]+(double)sq2YC[3])/2;
        //System.out.println(cX + " " + cY);
        if (cX >= (double)sq1XC[0]  && cX <= (double)sq1XC[2] && cY >= (double)sq1YC[0] && cY <= (double)sq1YC[2]) {
            System.out.println("YeS");
            System.exit(0);
        }
        //Rotate squares
        for (int i = 0; i < 4; i++) {
            int x = sq1X[i];
            int y = sq1Y[i];
            sq1X[i] = x+y;
            sq1Y[i] = x-y;
            sq1XC[i] = x+y;
            sq1YC[i] = x-y;
            x = sq2X[i];
            y = sq2Y[i];
            sq2X[i] = x+y;
            sq2Y[i] = x-y;
            sq2XC[i] = x+y;
            sq2YC[i] = x-y;
        }
        Arrays.sort(sq2XC);
        Arrays.sort(sq2YC);
        Arrays.sort(sq1XC);
        Arrays.sort(sq1YC);
        //Do same check again
        for (int i = 0; i < 4; i++) {
            int x = sq1X[i];
            int y = sq1Y[i];
            if (x >= sq2XC[0] && x <= sq2XC[2] && y>=sq2YC[0] && y<=sq2YC[2]) {
                System.out.println("YEs");
                System.exit(0);
            }
        }
        //Check center of 45 square
        cX = ((double)sq1XC[0]+(double)sq1XC[3])/2;
        cY = ((double)sq1YC[0]+(double)sq1YC[3])/2;
        if (cX >= (double)sq2XC[0]  && cX <= (double)sq2XC[2] && cY >= (double)sq2YC[0] && cY <= (double)sq2YC[2]) {
            System.out.println("YES");
            System.exit(0);
        }
        System.out.println("NO");

    }
    public static void print(int[] arr) {
        StringBuilder stringBuilder = new StringBuilder();
        for(int i = 0; i < 4; i++) {
            stringBuilder.append(arr[i]);
            stringBuilder.append(" ");
        }
        System.out.println(stringBuilder.toString());
    }

}

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
	private PrintWriter pw;
	private long mod = 1000000 + 3;

	private StringBuilder ans_sb;
	private int size = 1000005;
	private void soln() {
		int x1 = nextInt();
		int y1 = nextInt();
		int x2 = nextInt();
		int y2 = nextInt();
		int x3 = nextInt();
		int y3 = nextInt();
		int x4 = nextInt();
		int y4 = nextInt();

		int xx1 = nextInt();
		int yx1 = nextInt();
		int xx2 = nextInt();
		int yx2 = nextInt();
		int xx3 = nextInt();
		int yx3 = nextInt();
		int xx4 = nextInt();
		int yx4 = nextInt();

		//System.out.println(ll1.toString());
		for(int i=-100;i <= 100; i++) {
			for(int j=-100; j<= 100; j++) {
				int d1 = dist(x1,y1,x2,y2,i,j);
				int d2 = dist(x3,y3,x4,y4,i,j);
				int dist = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);

				int d3 = dist(x2,y2,x3,y3,i,j);
				int d4 = dist(x4,y4,x1,y1,i,j);

				int d5 = dist(xx1,yx1,xx2,yx2,i,j);
				int d6 = dist(xx3,yx3,xx4,yx4,i,j);
				int dist1 = (xx2-xx1)*(xx2-xx1) + (yx2-yx1)*(yx2-yx1);

				int d7 = dist(xx2,yx2,xx3,yx3,i,j);
				int d8 = dist(xx4,yx4,xx1,yx1,i,j);

				if((d1 + d2) == dist && (d3+d4)==dist &&(d5 + d6) == dist1 && (d7+d8)==dist1) {
					System.out.println("YES");
					System.exit(0);
				}
			}
		}
		System.out.println("NO");

	}
	private int dist(int x1, int y1, int x2, int y2, int x, int y) {
		int v1 = Math.abs((y1-y2)*x -(x2-x1)*y + x2*y1 - y2*x1);
		//double v2 = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
		return v1;
	}
	private class Line{
		int a, b, c;
		public Line(int x, int y, int z) {
			a = x;
			b = y;
			c = z;
//			if(a == 0 && b == 0) {
//
//			}
		}
		public String toString() {
			return "["+a+" "+b+" "+c+"]";
		}
	}
	private boolean find(Line l1, Line l2, int x, int y) {
		boolean f = true;
		int v1 = l1.a*x + l1.b*y +l1.c;
		int v2 = l2.a*x + l2.b*y +l2.c;
		//debug(v1+" "+v2+" "+x+" "+y);
		if(v1 > 0 && v2 > 0)
			f = false;
		if(v1 < 0 && v2 < 0)
			f = false;
		return f;
	}
	private boolean find1(Line l1, Line l2, int x, int y) {
		boolean f = false;
		int v1 = l1.a*x + l1.b*y +l1.c;
		int v2 = l2.a*x + l2.b*y +l2.c;
		//debug(v1+" "+v2+" "+x+" "+y);
		if(v1 > 0 && v2 > 0)
			f = true;
		if(v1 < 0 && v2 < 0)
			f = true;
		return f;
	}
	public class Pair implements Comparable<Pair>{
		int i,j, idx;
		public Pair(int a,int b, int c) {
			i = a;
			j = b;
			idx = c;
		}
		@Override
		public int compareTo(
				Pair o)
		{
			return this.i - o.i;
		}
		public String toString() {
			return "["+i+" "+j+"]";
		}
	}
	private int contains(int[] arr, int x) {
		for(int i=0;i<arr.length;i++) {
			if(arr[i] == x) {
				return i;
			}
		}
		return -1;
	}
	private class Query implements Comparable<Query>{
		int i, idx, x, y, mul;
		public Query(int a, int b, int c, int d, int m) {
			i = a;
			idx = b;
			x = c;
			mul = m;
			y = d;
		}
		@Override
		public int compareTo(
				Query o)
		{
			return this.i - o.i;
		}
	}
	private long[][] pow(int a, int b, int n) {
		long[][] mat = {{a,0,b},{1L,0,0},{0,1L,0}};
		if(n == 1)
			return mat;
		long[][] res = pow(a,b,n/2);
		res = multiply(res,res);
		if((n&1) != 0)
			res = multiply(mat, res);
		return res;
	}
	private long[][] multiply(long[][] a, long[][] b) {
		long[][] ret = new long[3][3];
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				for(int k=0;k<3;k++)
					ret[i][j] = (ret[i][j] + ((a[i][k]*b[k][j])%mod))%mod;
		return ret;
	}
	private class Node{
		Node left,right;
		int sum;
		public Node(int v) {
			sum=v;
		}
		public Node (Node left,Node right){
			this.left = left;
			this.right = right;
			if (left != null)
				sum = sum + left.sum;
			if (right != null)
				sum = sum + right.sum;
		}
	}
	public Node build(int l,int r) {
		if(l==r)
			return new Node(0);
		int mid=l+((r-l)>>1);
		Node left=build(l,mid);
		Node right=build(mid+1,r);
		return new Node(left,right);
	}
	public int query(int l,int r, Node root) {
		return queryutil(l,r,root,0,size-1);
	}
	public int queryutil(int x,int y,Node node,int l,int r) {
		if(l>y || x>r)
			return 0;
		if(x <= l && r<=y)
			return node.sum;
		int mid=l+((r-l)>>1);
		return queryutil(x,y,node.left,l,mid) + queryutil(x,y,node.right,mid+1,r);
	}
	public Node newNode(int pos,int val,Node node) {
		return newNodeUtil(pos,val,node,0,size-1);
	}
	public Node newNodeUtil(int pos,int val,Node node,int l, int r) {
		if(l==r)
			return new Node(val);
		int mid=l+((r-l)>>1);
		if(pos<=mid) {
			Node left=newNodeUtil(pos,val,node.left,l,mid);
			return new Node(left,node.right);
		}else {
			Node right=newNodeUtil(pos,val,node.right,mid+1,r);
			return new Node(node.left,right);
		}
	}
	private void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
	private long pow(long a, long b, long c) {
		if (b == 0)
			return 1;
		long p = pow(a, b / 2, c);
		p = (p * p) % c;
		return (b % 2 == 0) ? p : (a * p) % c;
	}

	private long gcd(long n, long l) {
		if (l == 0)
			return n;
		return gcd(l, n % l);
	}

	public static void main(String[] args) throws Exception {
		new Thread(null, new Runnable() {
			@Override
			public void run() {
				new Main().solve();
			}
		}, "1", 1 << 26).start();
		//new Main().solve();
	}

	public StringBuilder solve() {
		InputReader(System.in);
		/*
		 * try { InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\in.txt"));
		 * } catch(FileNotFoundException e) {}
		 */
		pw = new PrintWriter(System.out);
		// ans_sb = new StringBuilder();
		soln();

		pw.close();
		// System.out.println(ans_sb);
		return ans_sb;
	}

	public void InputReader(InputStream stream1) {
		stream = stream1;
	}

	private boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

	private int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	private int nextInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private long nextLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private String nextToken() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	private String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	private int[] nextIntArray(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextInt();
		}
		return arr;
	}

	private long[] nextLongArray(int n) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextLong();
		}
		return arr;
	}

	private void pArray(int[] arr) {
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private void pArray(long[] arr) {
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	private char nextChar() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		char c1 = (char) c;
		while (!isSpaceChar(c))
			c = read();
		return c1;
	}

	private interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

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

public class Main
{
	public static void main(String[] args)
	{
		FastReader reader = new FastReader();
		PrintWriter writer = new PrintWriter(System.out);

		double root = Math.sqrt(2);
		double[][][] point1 = new double[5][2][2];

		double one=0, two=0;

		for (int i=0; i<4; i++)
		{
			point1[i][0][0] = reader.nextInt();
			point1[i][1][0] = reader.nextInt();

			point1[i][0][1] = (point1[i][0][0] - point1[i][1][0])*root;
			point1[i][1][1] = (point1[i][0][0] + point1[i][1][0])*root;

			one += point1[i][0][0]/4;
			two += point1[i][1][0]/4;
		}

		point1[4][0][0] = one;
		point1[4][1][0] = two;

		point1[4][0][1] = (one - two)*root;
		point1[4][1][1] = (one + two)*root;

		one=0;
		two=0;

		double[][][] point2 = new double[5][2][2];

		for (int i=0; i<4; i++)
		{
			point2[i][0][0] = reader.nextInt();
			point2[i][1][0] = reader.nextInt();

			point2[i][0][1] = (point2[i][0][0] - point2[i][1][0])*root;
			point2[i][1][1] = (point2[i][0][0] + point2[i][1][0])*root;

			one += point2[i][0][0]/4;
			two += point2[i][1][0]/4;
		}

		point2[4][0][0] = one;
		point2[4][1][0] = two;

		point2[4][0][1] = (one - two)*root;
		point2[4][1][1] = (one + two)*root;

		boolean ans = false;

		for (int i=0; i<5; i++)
		{
			double lowx = point1[0][0][0];
			double highx = point1[0][0][0];

			double lowy = point1[0][1][0];
			double highy = point1[0][1][0];

			for (int j=0; j<4; j++)
			{
				lowx = Math.min (lowx, point1[j][0][0]);
				highx = Math.max (highx, point1[j][0][0]);

				lowy = Math.min (lowy, point1[j][1][0]);
				highy = Math.max (highy, point1[j][1][0]);
			}

			if (point2[i][0][0] <= highx && point2[i][0][0] >= lowx && point2[i][1][0] <= highy && point2[i][1][0] >= lowy)
				ans = true;
		}

		for (int i=0; i<5; i++)
		{
			double lowx = point2[0][0][1];
			double highx = point2[0][0][1];

			double lowy = point2[0][1][1];
			double highy = point2[0][1][1];

			for (int j=0; j<4; j++)
			{
				lowx = Math.min (lowx, point2[j][0][1]);
				highx = Math.max (highx, point2[j][0][1]);

				lowy = Math.min (lowy, point2[j][1][1]);
				highy = Math.max (highy, point2[j][1][1]);
			}

			if (point1[i][0][1] <= highx && point1[i][0][1] >= lowx && point1[i][1][1] <= highy && point1[i][1][1] >= lowy)
				ans = true;
		}

		if (ans)
			writer.println ("YES");
		else
			writer.println ("NO");
		writer.close();
	}

	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}
}

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

public class Main {

    void solve() {
        long x1[]=new long[4];
        long y1[]=new long[4];
        long x2[]=new long[4];
        long y2[]=new long[4];

        for(int i=0;i<4;i++){
            x1[i]=nl(); y1[i]=nl();
        }
        for(int i=0;i<4;i++){
            x2[i]=nl(); y2[i]=nl();
        }
        for(int i=0;i<4;i++){
            if(check(x1,y1,x2[i],y2[i])){
                pw.println("YES");
                return;
            }
        }
        long xx=-1,yy=-1;
        if(x2[0]==x2[2]) xx=x2[0];
        else xx=x2[1];
        if(y2[0]==y2[2]) yy=y2[0];
        else yy=y2[1];
       // pw.println(xx+" "+yy);
        if(check(x1,y1,xx,yy)){
            pw.println("YES");
            return;
        }
        long x0=x2[0],y0=y2[0];
        for(int i=0;i<4;i++){
            x2[i]-=x0; y2[i]-=y0;
             xx=x2[i];yy=y2[i];
            x2[i]=(xx+yy);
            y2[i]=(-xx+yy);
        }

        for(int i=0;i<4;i++){
            x1[i]-=x0; y1[i]-=y0;
             xx=x1[i];yy=y1[i];
            x1[i]=(xx+yy);
            y1[i]=(-xx+yy);
            if(check(x2,y2,x1[i],y1[i])){
                pw.println("YES");
                return;
            }
        }

        if(x1[0]==x1[2]) xx=x1[0];
        else xx=x1[1];
        if(y1[0]==y1[2]) yy=y1[0];
        else yy=y1[1];
        if(check(x2,y2,xx,yy)){
            pw.println("YES");
            return;
        }
        pw.println("NO");

    }
    boolean check(long x1[],long y1[],long x0,long y0){

        long mnx=Math.min(x1[0],Math.min(x1[1],x1[2])),mxx=Math.max(x1[0],Math.max(x1[1],x1[2]));
        long mny=Math.min(y1[0],Math.min(y1[1],y1[2])),mxy=Math.max(y1[0],Math.max(y1[1],y1[2]));

        return mnx<=x0 && x0<=mxx && mny<=y0 && y0<=mxy;

    }

    long M=(long)1e9+7;
    InputStream is;
    PrintWriter pw;
    String INPUT = "";
    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        pw = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        pw.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

    public static void main(String[] args) throws Exception { new Main().run(); }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div1_488A {

	static double[][] pt1;
	static double[][] pt2;

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

		StringTokenizer inputData = new StringTokenizer(reader.readLine());
		pt1 = new double[4][2];
		for (int i = 0; i < 4; i++) {
			pt1[i][0] = Integer.parseInt(inputData.nextToken());
			pt1[i][1] = Integer.parseInt(inputData.nextToken());
		}

		inputData = new StringTokenizer(reader.readLine());
		pt2 = new double[4][2];
		for (int i = 0; i < 4; i++) {
			pt2[i][0] = Integer.parseInt(inputData.nextToken());
			pt2[i][1] = Integer.parseInt(inputData.nextToken());
		}

		for (int i = 0; i < 4; i++) {
			if (inside(pt1[i], pt2)) {
				printer.println("YES");
				printer.close();
				return;
			}
			if (inside(pt2[i], pt1)) {
				printer.println("YES");
				printer.close();
				return;
			}
		}

		long c1X = 0;
		long c1Y = 0;
		long c2X = 0;
		long c2Y = 0;

		for (int i = 0; i < 4; i++) {
			c1X += pt1[i][0];
			c1Y += pt1[i][1];
			c2X += pt2[i][0];
			c2Y += pt2[i][1];
		}

		c1X /= 4;
		c1Y /= 4;
		c2X /= 4;
		c2Y /= 4;

		if (inside(new double[] { c1X, c1Y }, pt2)) {
			printer.println("YES");
			printer.close();
			return;
		}

		if (inside(new double[] { c2X, c2Y }, pt1)) {
			printer.println("YES");
			printer.close();
			return;
		}

		printer.println("NO");
		printer.close();
	}

	static boolean inside(double[] pt, double[][] pts) {
		long mag = -2;

		for (int i = 0; i < 4; i++) {
			double vX1 = pts[(i + 1) % 4][0] - pts[i][0];
			double vY1 = pts[(i + 1) % 4][1] - pts[i][1];
			double vX2 = pt[0] - pts[i][0];
			double vY2 = pt[1] - pts[i][1];
			double cCross = cross(vX1, vY1, vX2, vY2);
			if (cCross == 0) {
				continue;
			}
			if (mag == -2) {
				mag = cCross > 0 ? 1 : -1;
			} else {
				if ((cCross > 0 ? 1 : -1) != mag) {
					return false;
				}
			}
		}
		return true;
	}

	static double cross(double a, double b, double c, double d) {
		return a * d - b * c;
	}
}

import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import java.math.BigInteger;
public class Main
{
    static MyScanner scan;
    static PrintWriter pw;
    public static void main(String[] args) {
        new Thread(null,null,"_",1<<25)
        {
            public void run()
            {
                try
                {
                    solve();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static void solve() throws IOException
    {
        scan = new MyScanner();
        pw = new PrintWriter(System.out,true);
        StringBuilder sb = new StringBuilder();
        int maxx = -999,minx = 999,maxy = -999, miny = 999;
        for(int i=0;i<4;++i)
        {
            int x = ni();
            int y = ni();
            maxx = max(maxx,x);
            minx = min(minx,x);
            maxy = max(maxy,y);
            miny = min(miny,y);
        }
        int rightx=-1,righty=1,topx=0,topy=0,leftx=0,lefty=0,botx=0,boty=0;
        Pair p[] = new Pair[4];
        for(int i=0;i<4;++i)
            p[i] = new Pair(ni(),ni());
        int bhakk = 999;
        for(int i=0;i<4;++i)
        {
            if(p[i].x<bhakk)
            {
                leftx = p[i].x;
                lefty = p[i].y;
                bhakk = p[i].x;
            }
        }
        bhakk = -999;
        for(int i=0;i<4;++i)
        {
            if(p[i].x>bhakk)
            {
                bhakk = p[i].x;
                rightx = p[i].x;
                righty = p[i].y;
            }
        }
        bhakk = 999;
        for(int i=0;i<4;++i)
        {
            if(p[i].y<bhakk)
            {
                bhakk = p[i].y;
                botx = p[i].x;
                boty = p[i].y;
            }
        }
        bhakk = -999;
        for(int i=0;i<4;++i)
        {
            if(p[i].y>bhakk)
            {
                topx = p[i].x;
                topy = p[i].y;
                bhakk = p[i].y;
            }
        }
//        pl("rightx : "+rightx+" righty : "+righty);
//        pl("leftx : "+leftx+" lefty : "+lefty);
//        pl("topx : "+topx+" topy : "+topy);
//        pl("botx : "+botx+" boty : "+boty);
        int startx = leftx,starty = lefty,endx = topx,endy =  topy;
        boolean intersect = false;
        while(starty>=boty)
        {
            int currx = startx;
            int curry = starty;
            while(currx<=endx)
            {
                //pl("currx : "+currx+" curry : "+curry);
                if(minx<=currx && currx<=maxx && miny<=curry && curry<=maxy)
                {
                    intersect = true;
                }
                currx++;
                curry++;
            }
            startx++;
            starty--;
            endx++;
            endy--;
        }
        if(intersect)
            pl("Yes");
        else pl("No");
        pw.flush();
        pw.close();
    }
    static class MyC implements Comparator<Integer>
    {
        public int compare(Integer x,Integer y)
        {
            return y-x;
        }
    }
    static class Pair implements Comparable<Pair>
    {
        int x,y;
        Pair(int x,int y)
        {
            this.x = x;
            this.y = y;
        }
        public int compareTo(Pair other)
        {
            return this.x - other.x;
        }
        public String toString()
        {
            return "["+x+","+y+"]";
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static String ne() throws IOException
    {
        return scan.next();
    }
    static String nel() throws IOException
    {
        return scan.nextLine();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;
        MyScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String nextLine()throws IOException
        {
            return br.readLine();
        }
        String next() throws IOException
        {
            if(st==null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        int nextInt() throws IOException
        {
            return Integer.parseInt(next());
        }
        long nextLong() throws IOException
        {
            return Long.parseLong(next());
        }
        double nextDouble() throws IOException
        {
            return Double.parseDouble(next());
        }
    }
}

// practice with kaiboy
import java.io.*;
import java.util.*;

public class CF994C extends PrintWriter {
	CF994C() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF994C o = new CF994C(); o.main(); o.flush();
	}

	static final int INF = 100;
	void main() {
		int xmin, xmax, ymin, ymax;
		xmin = ymin = INF;
		xmax = ymax = -INF;
		for (int h = 0; h < 4; h++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			xmin = Math.min(xmin, x);
			xmax = Math.max(xmax, x);
			ymin = Math.min(ymin, y);
			ymax = Math.max(ymax, y);
		}
		int pmin, pmax, qmin, qmax;
		pmin = qmin = INF * 2;
		pmax = qmax = -INF * 2;
		for (int h = 0; h < 4; h++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int p = x + y, q = x - y;
			pmin = Math.min(pmin, p);
			pmax = Math.max(pmax, p);
			qmin = Math.min(qmin, q);
			qmax = Math.max(qmax, q);
		}
		for (int x = xmin; x <= xmax; x++)
			for (int y = ymin; y <= ymax; y++) {
				int p = x + y, q = x - y;
				if (pmin <= p && p <= pmax && qmin <= q && q <= qmax) {
					println("YES");
					return;
				}
			}
		println("NO");
	}
}

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

public class TwoSquaresA {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

		int a1 = 1000;
		int a2 = -1000;
		int b1 = 1000;
		int b2 = -1000;
		int a3 = 1000;
		int a4 = -1000;
		int b3 = 1000;
		int b4 = -1000;
		for (int i = 0; i < 4; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			a1 = Math.min(a1, a);
			a2 = Math.max(a2, a);
			b1 = Math.min(b1, b);
			b2 = Math.max(b2, b);
		}
		for (int i = 0; i < 4; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			a3 = Math.min(a3, a+b);
			a4 = Math.max(a4, a+b);
			b3 = Math.min(b3, a-b);
			b4 = Math.max(b4, a-b);
		}
		for (int i = a1; i <= a2; i++) {
			for (int j = b1; j <= b2; j++) {
				if (i+j>=a3&&i+j<=a4&&i-j>=b3&&i-j<=b4) {
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 *
 * @author pttrung
 */
public class A_Round_488_Div1 {

    public static long MOD = 998244353;
    static long[][][] dp;

    public static void main(String[] args) throws FileNotFoundException {
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File(
        // "output.txt")));
        PrintWriter out = new PrintWriter(System.out);
        Scanner in = new Scanner();
        Point[] a = new Point[4];
        Point[] b = new Point[4];
        for (int i = 0; i < 4; i++) {
            a[i] = new Point(in.nextInt(), in.nextInt());
        }
        for (int i = 0; i < 4; i++) {
            b[i] = new Point(in.nextInt(), in.nextInt());
        }

        boolean ok = false;
        for (Point x : a) {
            for (Point y : b) {
                ok |= x.equals(y);
            }
        }
        for (int i = 0; i < 4; i++) {
            ok |= isInside(a[i], b);
            ok |= isInside(b[i], a);
        }
        for (int i = 0; i < 4; i++) {
            int x = (i + 1) % 4;
            for (int j = 0; j < 4; j++) {
                int y = (j + 1) % 4;
                ok |= isIntersect(a[i], a[x], b[j], b[y]);
            }
        }
        if (ok) {
            out.println("YES");
        } else {
            out.println("NO");
        }
        out.close();
    }

    static boolean isIntersect(Point A, Point B, Point C, Point D) {
        return ccw(A, C, D) != ccw(B, C, D) && ccw(A, B, C) != ccw(A, B, D);
    }

    static boolean ccw(Point A, Point B, Point C) {
        return (C.y - A.y) * (B.x - A.x) > (B.y - A.y) * (C.x - A.x);
    }

    static boolean isInside(Point p, Point[] s) {
        double total = 0;
        for (int i = 0; i < 4; i++) {
            int nxt = (i + 1) % 4;
            Point x = new Point(s[i].x - p.x, s[i].y - p.y);
            Point y = new Point(s[nxt].x - p.x, s[nxt].y - p.y);
            total += angle(x, y);
            // System.out.println(Math.toDegrees(angle(x, y)));
        }
        //System.out.println(p + " " + Arrays.toString(s) + " " + total + " " + 2 * Math.PI);
        return Math.abs(total - 2 * Math.PI) < 1e-6;
    }

    static double angle(Point a, Point b) {
        double dot = a.x * b.x + a.y * b.y;
        double A = a.x * a.x + a.y * a.y;
        A = Math.sqrt(A);
        double B = b.x * b.x + b.y * b.y;
        B = Math.sqrt(B);
        double angle = dot / (A * B);
        return Math.acos(angle);
    }

    public static int[] KMP(String val) {
        int i = 0;
        int j = -1;
        int[] result = new int[val.length() + 1];
        result[0] = -1;
        while (i < val.length()) {
            while (j >= 0 && val.charAt(j) != val.charAt(i)) {
                j = result[j];
            }
            j++;
            i++;
            result[i] = j;
        }
        return result;

    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;
    }

    public static int digit(long n) {
        int result = 0;
        while (n > 0) {
            n /= 10;
            result++;
        }
        return result;
    }

    public static double dist(long a, long b, long x, long y) {
        double val = (b - a) * (b - a) + (x - y) * (x - y);
        val = Math.sqrt(val);
        double other = x * x + a * a;
        other = Math.sqrt(other);
        return val + other;

    }

    public static class Point implements Comparable<Point> {

        int x, y;

        public Point(int start, int end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = 47 * hash + this.x;
            hash = 47 * hash + this.y;
            return hash;
        }

        public String toString() {
            return x + " : " + y;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return Integer.compare(x, o.x);
        }
    }

    public static class FT {

        long[] data;

        FT(int n) {
            data = new long[n];
        }

        public void update(int index, long value) {
            while (index < data.length) {
                data[index] += value;
                index += (index & (-index));
            }
        }

        public long get(int index) {
            long result = 0;
            while (index > 0) {
                result += data[index];
                index -= (index & (-index));
            }
            return result;

        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static long pow(long a, long b, long MOD) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long val = pow(a, b / 2, MOD);
        if (b % 2 == 0) {
            return val * val % MOD;
        } else {
            return val * (val * a % MOD) % MOD;

        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //  br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class CC {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static boolean[][] gg = new boolean[201][201];

    public static void main(String args[]) {
        FastReader reader = new FastReader();

        int gminX=10000000,gminY=1000000,gmaxX=-100000,gmaxY=-100000;
        for (int i = 0; i < 8; i++) {
            int xx = reader.nextInt();
            if(i%2==0) {
                gminX = Math.min(xx, gminX);
                gmaxX = Math.max(xx, gmaxX);
            } else {
                gminY = Math.min(xx, gminY);
                gmaxY = Math.max(xx, gmaxY);
            }
        }
        gminX += 100;
        gmaxX += 100;
        gminY += 100;
        gmaxY += 100;
        int minX=1000000, maxX = -1000000, minY=1000000,maxY=-1000000;
        for (int i = 0; i < 8; i++) {
            int xx = reader.nextInt();
            if(i%2==0) {
                minX = Math.min(xx, minX);
                maxX = Math.max(xx, maxX);
            } else {
                minY = Math.min(xx, minY);
                maxY = Math.max(xx, maxY);
            }
        }
        minX += 100;
        maxX += 100;
        minY += 100;
        maxY += 100;

        for (int i = 0; i <= (gmaxY - gminY); i++) {
            for (int j = gminX; j <= gmaxX ; j++) {
                gg[j][gminY + i] = true;
            }
        }

        int len = (maxX-minX)/2;
        int stMinY = (minY+maxY)/2;
        int stMaxY = minY+len;
        for (int i = 0; i <= len; i++) {
            for (int j = minX+i; j <= maxX-i; j++) {
                if(gg[j][stMaxY + i]) {
                    System.out.println("YES");
                    return ;
                }
//                gg[j][stMaxY+i] = true;
            }
        }
        for (int i = 0; i <= len; i++) {
            for (int j = minX+i; j <= maxX-i; j++) {
                if(gg[j][stMaxY - i]) {
                    System.out.println("YES");
                    return ;
                }
//                gg[j][stMaxY-i] = true;
            }
        }

//        for (int i = 0; i < 201; i++) {
//            for (int j = 0; j < 201; j++) {
//                if(gg[i][j])
//                System.out.print("O");
//                else
//                    System.out.print(".");
//            }
//            System.out.println();
//        }

        System.out.println("NO");
    }
}

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

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

	FastReader in = new FastReader();
	PrintWriter out = new PrintWriter(System.out);
	void run(){
		work();
		out.flush();
	}
	long mod=998244353;
	long gcd(long a,long b) {
		return b==0?a:gcd(b,a%b);
	}
	int[] A,B;
	void work() {
		A=new int[] {99999999,-99999999,99999999,-99999999};//x1,x2,y1,y2
		B=new int[] {99999999,-99999999,-99999999,99999999};//l,u,r,d
		int[][] P1=new int[4][];
		int[][] P2=new int[4][];
		for(int i=0;i<4;i++) {
			int x=in.nextInt();
			int y=in.nextInt();
			P1[i]=new int[] {x,y};
			A[0]=Math.min(A[0], x);
			A[1]=Math.max(A[1], x);
			A[2]=Math.min(A[2], y);
			A[3]=Math.max(A[3], y);
		}
		for(int i=0;i<4;i++) {
			int x=in.nextInt();
			int y=in.nextInt();
			P2[i]=new int[] {x,y};
			B[0]=Math.min(B[0], x);
			B[1]=Math.max(B[1], y);
			B[2]=Math.max(B[2], x);
			B[3]=Math.min(B[3], y);
		}
		//不想交
		if(B[0]>A[1]||B[1]<A[2]||B[2]<A[0]||B[3]>A[3]) {
			out.println("NO");
			return;
		}
		//某点在正方形中
		if(check(A,P2[0])||check(A,P2[1])||check(A,P2[2])||check(A,P2[3])) {
			out.println("YES");
			return;
		}
		//某点在斜正方形中
		if(check3(P1[0],P2)||check3(P1[1],P2)||check3(P1[2],P2)||check3(P1[3],P2)) {
			out.println("YES");
			return;
		}
		//边相交
		if(check2(P1[0],P1[1],P2)||check2(P1[0],P1[3],P2)||check2(P1[2],P1[3],P2)||check2(P1[1],P1[2],P2)) {
			out.println("YES");
			return;
		}
		out.println("NO");
	}
	private boolean check2(int[] P1, int[] P2, int[][] P) {
		if(check5(P1,P2,P[0],P[1])||check5(P1,P2,P[0],P[3])||check5(P1,P2,P[1],P[2])||check5(P1,P2,P[2],P[3])) return true;
		return false;
	}
	private boolean check5(int[] P1, int[] P2, int[] P3, int[] P4) {
		if(Math.max(P1[0], P2[0])<Math.min(P3[0], P4[0]))return false;
		if(Math.min(P1[0], P2[0])>Math.max(P3[0], P4[0]))return false;
		if(Math.max(P1[1], P2[1])<Math.min(P3[1], P4[1]))return false;
		if(Math.min(P1[1], P2[1])>Math.max(P3[1], P4[1]))return false;
		if(P1[0]==P2[0]) {
			int x=P1[0];
			int ny=P3[1]-(P3[0]-x)*(P3[1]-P4[1])/(P3[0]-P4[0]);
			return ny>=Math.min(P1[1], P2[1])&&ny<=Math.max(P1[1], P2[1]);
		}else {
			int y=P1[1];
			int nx=P3[0]-(P3[1]-y)*(P3[0]-P4[0])/(P3[1]-P4[1]);
			return nx>=Math.min(P1[0], P2[0])&&nx<=Math.max(P1[0], P2[0]);
		}
	}
	private boolean check3(int[] P,int[][] A) {
		int x=P[0],y=P[1];
		if(check4(x,y,A[0],A[1])!=check4(x,y,A[2],A[3])&&check4(x,y,A[0],A[3])!=check4(x,y,A[1],A[2])) {
			return true;
		}
		return false;
	}
	private boolean check4(int x, int y, int[] P1, int[] P2) {
		return P1[1]-(P1[0]-x)*(P1[1]-P2[1])/(P1[0]-P2[0])>y;
	}
	private boolean check(int[] A, int[] P) {
		if(A[0]<=P[0]&&A[1]>=P[0]&&A[2]<=P[1]&&A[3]>=P[1]) {
			return true;
		}
		return false;
	}
}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

	public FastReader()
	{
		br=new BufferedReader(new InputStreamReader(System.in));
	}

	public String next()
	{
		if(st==null || !st.hasMoreElements())
		{
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	public int nextInt()
	{
		return Integer.parseInt(next());
	}

	public long nextLong()
	{
		return Long.parseLong(next());
	}
}

//package com.company;

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

public class Main {
    static long TIME_START, TIME_END;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("Test.in"));
        PrintWriter pw = new PrintWriter(System.out);
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out"));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.in"));
        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
//        System.out.println("Memory increased:" + (usedMemoryAfter-usedMemoryBefore) / 1000000 );
//        System.out.println("Time used: " + (TIME_END - TIME_START) + ".");
    }

    public static class Task {

        public class Point {
            int x, y;

            public Point(int x, int y) {
                this.x = x;
                this.y = y;
            }
        }

        boolean onSeg(Point p, Point q, Point r) {
            return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) &&
                    q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);

        }

        int orientation(Point p, Point q, Point r)
        {
            int val = (q.y - p.y) * (r.x - q.x) -
                    (q.x - p.x) * (r.y - q.y);
            if (val == 0) return 0;
            return (val > 0)? 1: 2;
        }

        boolean inter(Point p1, Point q1, Point p2, Point q2)
        {
            int o1 = orientation(p1, q1, p2);
            int o2 = orientation(p1, q1, q2);
            int o3 = orientation(p2, q2, p1);
            int o4 = orientation(p2, q2, q1);
            if (o1 != o2 && o3 != o4)
                return true;
            if (o1 == 0 && onSeg(p1, p2, q1)) return true;
            if (o2 == 0 && onSeg(p1, q2, q1)) return true;
            if (o3 == 0 && onSeg(p2, p1, q2)) return true;
            if (o4 == 0 && onSeg(p2, q1, q2)) return true;
            return false;
        }

        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            Point[] lines2 = new Point[4];
            Point[] lines1 = new Point[4];

            for (int i = 0; i < 4; i++) {
                int x1 = sc.nextInt();
                int y1 = sc.nextInt();
                lines1[i] = new Point(x1, y1);
            }
            for (int i = 0; i < 4; i++) {
                int x1 = sc.nextInt();
                int y1 = sc.nextInt();
                lines2[i] = new Point(x1, y1);
            }
            int minX = Integer.MAX_VALUE, minY = Integer.MAX_VALUE;
            int maxX = Integer.MIN_VALUE, maxY = Integer.MIN_VALUE;
            for (int i = 0; i < 4; i++) {
                minX = Math.min(minX, lines1[i].x);
                minY = Math.min(minY, lines1[i].y);
                maxX = Math.max(maxX, lines1[i].x);
                maxY = Math.max(maxY, lines1[i].y);
            }
            boolean inr = false;
            for (int i = minX; i <= maxX; i++) {
                Point p1 = new Point(i, minY);
                Point p2 = new Point(i, maxY);
                for (int j = 0; j < 4; j++) {
                    Point p3 = new Point(lines2[j].x, lines2[j].y);
                    Point p4 = new Point(lines2[(j + 1) % 4].x, lines2[(j + 1) % 4].y);
                    if (inter(p1, p2, p3, p4)) {
                        inr = true;
                    }
                }
            }
            boolean ins = solve(lines1, lines2);

            if (inr || ins) {
                pw.println("YES");
            } else {
                pw.println("NO");
            }

        }
        public boolean solve(Point[] lines1, Point[] lines2) {

            int minX = Integer.MAX_VALUE, minY = Integer.MAX_VALUE;
            int maxX = Integer.MIN_VALUE, maxY = Integer.MIN_VALUE;
            for (int i = 0; i < 4; i++) {
                minX = Math.min(minX, lines2[i].x);
                minY = Math.min(minY, lines2[i].y);
                maxX = Math.max(maxX, lines2[i].x);
                maxY = Math.max(maxY, lines2[i].y);
            }
            boolean inr = false;
            int t = (maxX - minX) / 2;
            for (int i = 0; i <= t; i++) {
                Point p1 = new Point(minX + i, maxY - t + i);
                Point p2 = new Point(maxX - t + i, minY + i);
                for (int j = 0; j < 4; j++) {
                    Point p3 = new Point(lines1[j].x, lines1[j].y);
                    Point p4 = new Point(lines1[(j + 1) % 4].x, lines1[(j + 1) % 4].y);
                    if (inter(p1, p2, p3, p4)) {
                        inr = true;
                    }
                }
            }
            return inr;
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public Scanner(FileReader s) throws FileNotFoundException {br = new BufferedReader(s);}

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

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

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

        public String nextLine() throws IOException {return br.readLine();}

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

        public boolean ready() throws IOException {return br.ready();}
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.PrintWriter;

public class Main {

    public static void main(String[]args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());
        P[] s1 = new P[4];
        LS[] l1 = new LS[4];
        build(st, s1, l1);
        st = new StringTokenizer(br.readLine());
        P[] s2 = new P[4];
        LS[] l2 = new LS[4];
        build(st, s2, l2);

        boolean inter = false;
        for (int i = 0; i < 4; i++) {
            if (inside(s1[i], s2)) {
                inter = true;
                //debug("in 1", s1[i]);
            }
        }
        for (int i = 0; i < 4; i++) {
            if (inside(s2[i], s1)) {
                inter = true;
                //debug("in 2", s2[i]);
            }
        }
        //debug(l1, l2);
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                if (crosses(l1[i], l2[j])) {
                    inter = true;
                    //debug("in 3", l1[i], l2[j], i, j);
                }
            }
        }
        if (inter) {
            pw.println("YES");
        }
        else {
            pw.println("NO");
        }
        pw.flush();
    }

    private static boolean crosses(LS l1, LS l2) {
        if (l1.xs == l1.xe) {
            double t = l2.getXT(l1.xs);
            if (t < 0 || t > 1) {
                return false;
            }
            double yt = (1 - t)*l2.ys + t*l2.ye;
            return l1.containsY(yt);
        }
        else {
            double t = l2.getYT(l1.ys);
            if (t < 0 || t > 1) {
                return false;
            }
            double xt = (1 - t)*l2.xs + t*l2.xe;
            return l1.containsX(xt);
        }
    }

    public static int sign(int s) {
        return (s < 0) ? -1 : (s > 0 ? 1 : 0);
    }

    public static int cross(P a, P b, P o) {
        return sign((a.x - o.x) * (b.y - o.y) - (b.x - o.x) * (a.y - o.y));
    }

    private static boolean inside(P p, P[] s2) {
        int ls = 0;
        for (int i = 0; i < s2.length; i++) {
            P o = s2[i];
            P b = (i == s2.length - 1) ? s2[0] : s2[i + 1];
            int sign = cross(p, b, o);
            if (i > 0) {
                if (ls != sign) return false;
            }
            ls = sign;
        }
        return true;
    }

    private static void build(StringTokenizer st, P[] s1, LS[] l1) {
        for (int i = 0; i < 4; i++) {
            int x = Integer.parseInt(st.nextToken());
            int y = Integer.parseInt(st.nextToken());
            s1[i] = new P(x, y);
        }
        for (int i = 0; i < 4; i++) {
            P p1 = s1[i];
            P p2 = s1[(i == 3) ? 0 : i + 1];
            l1[i] = new LS(p1.x, p1.y, p2.x, p2.y);
        }
    }

    private static class P {
        int x;
        int y;

        public P(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "P{" +
                    "x=" + x +
                    ", y=" + y +
                    '}';
        }
    }

    private static class LS {
        int xs;
        int ys;
        int xe;
        int ye;

        public LS(int xs, int ys, int xe, int ye) {
            this.xs = xs;
            this.ys = ys;
            this.xe = xe;
            this.ye = ye;
        }

        public double getXT(double ox) {
            double se = (xe - xs);
            return (ox - xs) / se;
        }
        public double getYT(double oy) {
            double se = (ye - ys);
            return (oy - ys) / se;
        }

        public boolean containsY(double yt) {
            double t = getYT(yt);
            return t >= 0 && t <= 1;
        }
        public boolean containsX(double xt) {
            double t = getXT(xt);
            return t >= 0 && t <= 1;
        }

        @Override
        public String toString() {
            return "LS{" +
                    "xs=" + xs +
                    ", ys=" + ys +
                    ", xe=" + xe +
                    ", ye=" + ye +
                    '}';
        }
    }

    public static void debug(Object...args) {
        System.out.println(Arrays.deepToString(args));
    }
}

import java.util.Scanner;

public class Squares {
    public static void main(String... args) {
        //init
        Scanner scanner = new Scanner(System.in);
        Point[] points1 = new Point[4];
        for (int i = 0; i < 4; i++) {
            points1[i] = new Point(scanner.nextInt(), scanner.nextInt());
        }
        Square square = new Square(points1);
        Point[] points2 = new Point[4];
        for (int i = 0; i < 4; i++) {
            points2[i] = new Point(scanner.nextInt(), scanner.nextInt());
        }

        float x = 0;
        float y = 0;
        for (Point p : points2) {
            x += p.x;
            y += p.y;
            if (square.contains(p)) {
                System.out.print("YES");
                return;
            }
        }
        x /= 4;
        y /= 4;//center of second square
        if (square.contains(new Point(x, y))) {
            System.out.print("YES");
            return;
        }

        for (int i = 0; i < 4; i++) {
            points1[i] = rotatePoint(points1[i]);
            points2[i] = rotatePoint(points2[i]);
        }
        Square rotatedSquare = new Square(points2);
        for (Point p : points1) {
            if (rotatedSquare.contains(p)) {
                System.out.print("YES");
                return;
            }
        }
        System.out.print("NO");
    }

    private static Point rotatePoint(Point point) {
//        double temp = Math.sqrt(2)/2;
//        double newX = point.x - x;
//        double newY = point.y - y;
//        newX = (newX * temp - newY*temp);
//        newY = (newY*temp + newX*temp);
//        newX += x;
//        newY += y;
        return new Point(point.x+point.y, point.x-point.y);
    }

    private static class Point {
        double x;
        double y;
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
        public Point(double x, double y) {
            this.x = x;
            this.y = y;
        }
    }

    private static class Square {
        Point[] points;
        double left;
        double right;
        double bottom;
        double top;
        Square(Point[] points) {
            this.points = points;
            left = points[0].x;
            right = points[0].x;
            bottom = points[0].y;
            top = points[0].y;
            for (Point p : points) {
                if (p.x < left) {
                    left = p.x;
                }
                if (p.x > right) {
                    right = p.x;
                }
                if (p.y < bottom) {
                    bottom = p.y;
                }
                if (p.y > top) {
                    top = p.y;
                }
            }
        }

        public boolean contains(Point p) {
            return left <= p.x && right >= p.x && top >= p.y && bottom <= p.y;
        }
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class C {
    static class Point {
        int x,y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Point point = (Point) o;
            return x == point.x &&
                    y == point.y;
        }

        @Override
        public int hashCode() {

            return Objects.hash(x, y);
        }

        @Override
        public String toString() {
            return x+","+y;
        }
    }
    static class Square {
        List<Point> points = new ArrayList<>();
    }

    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();

        Square A = readSquare(scanner);
        Square B = readSquare(scanner);

        Set<Point> regions = new HashSet<>();
        Point center = center(B);
        draw(regions, B.points.get(0), B.points.get(1), center);
        draw(regions, B.points.get(1), B.points.get(2), center);
        draw(regions, B.points.get(2), B.points.get(3), center);
        draw(regions, B.points.get(3), B.points.get(0), center);

        int minx = A.points.stream().mapToInt(Point::getX).min().getAsInt();
        int maxx = A.points.stream().mapToInt(Point::getX).max().getAsInt();
        int miny = A.points.stream().mapToInt(Point::getY).min().getAsInt();
        int maxy = A.points.stream().mapToInt(Point::getY).max().getAsInt();

        for (int x=minx; x<=maxx; ++x) {
            for (int y=miny; y<=maxy;++y) {
                if (regions.contains(new Point(x,y))) {
                    System.out.println("YES");
                    return;
                }
            }
        }

        System.out.println("NO");
    }

    private static Point center(Square A) {
        int minx = A.points.stream().mapToInt(Point::getX).min().getAsInt();
        int maxx = A.points.stream().mapToInt(Point::getX).max().getAsInt();
        int miny = A.points.stream().mapToInt(Point::getY).min().getAsInt();
        int maxy = A.points.stream().mapToInt(Point::getY).max().getAsInt();
        int midx = 0;
        int midy =0;
        for (Point p: A.points) {
            if(p.x!=minx&&p.x!=maxx) {
                midx=p.x;
                break;
            }
        }
        for (Point p: A.points) {
            if(p.y!=miny&&p.y!=maxy) {
                midy=p.y;
                break;
            }
        }
        return new Point(midx,midy);
    }

    static void draw(Set<Point> regions, Point a, Point b,Point c) {
        List<Integer> xs = new ArrayList<>();
        List<Integer> ys = new ArrayList<>();
        if (a.x<b.x) {
            for (int x = a.x; x <= b.x; ++x) {
                xs.add(x);
            }
        } else {
            for (int x = a.x; x >= b.x; --x) {
                xs.add(x);
            }
        }
        if (a.y<b.y) {
            for (int y=a.y;y<=b.y;++y) {
                ys.add(y);
            }
        } else {
            for (int y=a.y;y>=b.y;--y) {
                ys.add(y);
            }
        }

        for (int i=0; i<xs.size();++i) {
            regions.add(new Point(xs.get(i), ys.get(i)));
            for (int xx=xs.get(i); xx<=c.x;++xx) {
                regions.add(new Point(xx,ys.get(i)));
            }
            for (int xx=xs.get(i); xx>=c.x;--xx) {
                regions.add(new Point(xx,ys.get(i)));
            }
        }
    }

    private static Square readSquare(FastScanner scanner) {
        Square A = new Square();
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        return A;
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Main
{
    static long mod=1000000007;
    public static void main(String[] args) throws Exception
    {
    	FastReader in=new FastReader();
    	PrintWriter pw=new PrintWriter(System.out);
    	int axmax=-101,axmin=101,aymax=-101,aymin=101;
    	int bxmax=-101,bxmin=101,bymax=-101,bymin=101;
    	int[][] c=new int[8][2];
    	for(int i=0;i<8;i++)
    	{
    		int x=in.nextInt();
    		int y=in.nextInt();
    		if(i>3)
    		{
    			c[i][0]=x-y;
    			c[i][1]=x+y;
    		}
    		else
    		{
    			c[i][0]=x;
    			c[i][1]=y;
    		}
    	}
    	for(int i=0;i<4;i++)
    	{
			axmin=Math.min(axmin,c[i][0]);
			axmax=Math.max(axmax,c[i][0]);
			aymin=Math.min(aymin,c[i][1]);
			aymax=Math.max(aymax,c[i][1]);
    	}
    	for(int i=4;i<8;i++)
    	{
			bxmin=Math.min(bxmin,c[i][0]);
			bxmax=Math.max(bxmax,c[i][0]);
			bymin=Math.min(bymin,c[i][1]);
			bymax=Math.max(bymax,c[i][1]);
    	}
    	String ans="NO";
    	for(int x=axmin;x<=axmax;x++)
    	{
    		for(int y=aymin;y<=aymax;y++)
    		{
    			if(bxmin<=x-y && x-y<=bxmax && bymin<=x+y && x+y<=bymax)
    				ans="YES";
    		}
    	}
    	pw.print(ans);
    	pw.flush();
    }

    public static long inverse(long a)
    {
    	long r=1,p=mod-2;
    	while(p>0)
    	{
    		if(p%2==1)
    		{
    			r*=a;
    			r%=mod;
    		}
    		p>>=1;
    		a=(a*a)%mod;
    	}

    	return r;
    }

}

class pair<A,B>
{
    A f;
    B s;

    public pair(A a,B b)
    {
        f=a;
        s=b;
    }
}

class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        br=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next() throws IOException
    {
        if(st==null || !st.hasMoreElements())
        {
            st=new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

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

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

import javax.xml.crypto.dsig.keyinfo.KeyName;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;

public class Main {
    public static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    public static int[][] arr1;
    public static int[][] arr2;
    public static int xa,ya;
    public static int read() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }

    public static boolean isInSquare1(int x, int y){
        int x1,y1,x2,y2;
        x1=Math.min(arr1[0][0],arr1[2][0]);
        y1=Math.min(arr1[0][1],arr1[2][1]);
        x2=Math.max(arr1[0][0],arr1[2][0]);
        y2=Math.max(arr1[0][1],arr1[2][1]);
        if (x1<=x && x<=x2 && y1<=y && y<=y2) return true;
        return false;
    }

    public static boolean isInSquare2(int x, int y){
          if (Math.abs(x-xa)+Math.abs(y-ya)<=Math.abs(xa-arr2[0][0])+Math.abs(ya-arr2[0][1])) return true;
          return false;
    }

    public static void main(String[] args) throws IOException {
        arr1 = new int[4][2];
        for (int i = 0; i < 8; i++) {
            arr1[i / 2][i % 2] = read();
        }
        arr2 = new int[4][2];
        for (int i=0; i<8; i++) arr2[i/2][i%2]=read();
        xa=(arr2[0][0]+arr2[1][0]+arr2[2][0]+arr2[3][0])/4;
        ya=(arr2[0][1]+arr2[1][1]+arr2[2][1]+arr2[3][1])/4;
        int xb,yb;
        xb=(arr1[2][0]+arr1[0][0])/2;
        yb=(arr1[2][1]+arr1[0][1])/2;
        boolean b=false;
        if (isInSquare1(xa,ya)) b=true;
        if (isInSquare2(xb,yb)) b=true;
        for (int i=0; i<4; i++){
            if (isInSquare1(arr2[i][0],arr2[i][1])) b=true;
            //System.out.println(b);
            if (isInSquare2(arr1[i][0],arr1[i][1])) b=true;
            //System.out.println(b);
        }
        if (b) System.out.println("Yes"); else System.out.println("No");
        //System.out.println(xa+" "+ya);
        //System.out.println(xb+" "+yb);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            Polygon p1 = new Polygon();
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            Rectangle r = p1.getBounds();
            Polygon p2 = new Polygon();
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            boolean inside = p2.intersects(r);
            boolean point = false;
            point |= intersPoint(p1, p2);
            point |= intersPoint(p2, p1);
            out.println((inside || point) ? "YES" : "NO");
        }

        boolean intersPoint(Polygon p1, Polygon p2) {
            for (int i = 0; i < p1.npoints; i++) {
                int i2 = (i + 1) % p1.npoints;
                int dx = p1.xpoints[i] - p1.xpoints[i2];
                int dy = p1.ypoints[i] - p1.ypoints[i2];
                Double edge = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
                for (int j = 0; j < p2.npoints; j++) {
                    dx = p1.xpoints[i] - p2.xpoints[j];
                    dy = p1.ypoints[i] - p2.ypoints[j];
                    Double edge1 = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
                    dx = p2.xpoints[j] - p1.xpoints[i2];
                    dy = p2.ypoints[j] - p1.ypoints[i2];
                    Double edge2 = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
                    if (edge1 + edge2 == edge) return true;
                }
            }
            return false;
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Arrays;
import java.util.Scanner;

public class C {

	static class Point {
		int x;
		int y;

		public Point(int xx, int yy) {
			x = xx;
			y = yy;
		}
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Point[] a = new Point[4];
		for(int i = 0; i < 4; ++i) a[i] = new Point(in.nextInt(), in.nextInt());

		Point[] b = new Point[4];
		for(int i = 0; i < 4; ++i) b[i] = new Point(in.nextInt(), in.nextInt());
		in.close();

		if(check(a,b)) {
			System.out.println("YES");
		}
		else System.out.println("NO");

	}

	static boolean check(Point[] a, Point[] b) {

		for(int i = 0; i < 4; ++i) {
			for(int j = 0; j < 4; ++j) {
				if(intersect(a[i], a[(i+1)%4], b[j], b[(j+1)%4])) {
//					System.out.println("i = " + i + " j  = " + j);
//					System.out.println("From (" + a[i].x + ", " + a[i].y +") to (" + a[(i+1)%4].x + ", " + a[(i+1)%4].y +")");
//					System.out.println("From (" + b[j].x + ", " + b[j].y +") to (" + b[(j+1)%4].x + ", " + b[(j+1)%4].y +")");
					return true;
				}
			}
		}

		for(int i = 0; i < 4; ++i) {
			if(isInside(a, b[i])) {
		//		System.out.println("i = " + i);
				return true;
			}
		}

		for(int i = 0; i < 4; ++i) {
			if(isInside(b, a[i])) return true;
		}
		return false;
	}

	static boolean isInside(Point[] polygon, Point p)
	{
	    // There must be at least 3 vertices in polygon[]
	    if (polygon.length < 3)  return false;

	    // Create a point for line segment from p to infinite
	    Point extreme = new Point(10000, p.y);

	    // Count intersections of the above line with sides of polygon
	    int count = 0, i = 0;
	    do
	    {
	        int next = (i+1)%polygon.length;

	        // Check if the line segment from 'p' to 'extreme' intersects
	        // with the line segment from 'polygon[i]' to 'polygon[next]'
	        if (intersect(polygon[i], polygon[next], p, extreme))
	        {
	            // If the point 'p' is colinear with line segment 'i-next',
	            // then check if it lies on segment. If it lies, return true,
	            // otherwise false
	            if (direction(polygon[i], p, polygon[next]) == 0) {
	               return onSegment(polygon[i], polygon[next], p);
	            }

	            count++;
	        }
	        i = next;
	    } while (i != 0);

	    // Return true if count is odd, false otherwise
	    return (count%2 == 1);
	}

	public static boolean intersect(Point p1, Point p2, Point p3, Point p4) {
		int d1 = direction(p3, p4, p1); // p3p4, p3p1
		int d2 = direction(p3, p4, p2);
		int d3 = direction(p1, p2, p3);
		int d4 = direction(p1, p2, p4);
		if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0))) {
//			System.out.println("Here1");
			return true;
		}
		else if (d1 == 0 && onSegment(p3, p4, p1)) {
//			System.out.println("Here2");
			return true;
		}
		else if (d2 == 0 && onSegment(p3, p4, p2)) {
//			System.out.println("Here3");
			return true;
		}
		else if (d3 == 0 && onSegment(p1, p2, p3)) {
//			System.out.println("Here4");
			return true;
		}
		else if (d4 == 0 && onSegment(p1, p2, p4)) {
//			System.out.println("Here5");
			return true;
		}
		return false;
	}

	public static int direction(Point p1, Point p2, Point p3) {
		return (p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y);
	}

	public static boolean onSegment(Point p1, Point p2, Point p3) {
		return Math.min(p1.x, p2.x) <= p3.x && p3.x <= Math.max(p1.x, p2.x) && Math.min(p1.y, p2.y) <= p3.y
				&& p3.y <= Math.max(p1.y, p2.y);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

	static boolean visited[] ;
	static boolean ends[] ;
	static long mod = 1000000007 ;
	static int lens[] ;
	static int seeds[] ;
	static int a[] ;
	static double total ;
	public static ArrayList adj[] ;
	public static long x,y ;
	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc =  new Scanner(System.in) ;

		int x1[]= new int[4] ;
		int y1[]= new int[4] ;
		int x2[] = new int[4] ;
		int y2[] = new int[4] ;

		//sss

		for (int i = 0; i < 4; i++)
		{
			x1[i]=sc.nextInt() ;
			y1[i]=sc.nextInt() ;

		}
		for (int i = 0; i < 4 ;i++)
		{
			x2[i]=sc.nextInt() ;
			y2[i]=sc.nextInt() ;
		}

		Arrays.sort(x1);
		Arrays.sort(x2);
		Arrays.sort(y1);
		Arrays.sort(y2);

		int h=y2[3]-y2[0] ;
		h=h/2 ;
		int begin=y2[0]+h ;
		HashMap<point, Integer> map =  new HashMap<point,Integer>() ;

		for (int i = 0; i <=h; i++)
			for (int j = x2[0]+i; j <=x2[3]-i; j++)
			{
				map.put(new point(j,begin+i),0) ;
				map.put(new point(j,begin-i),0) ;
			}

		for (int i = x1[0]; i <= x1[3]; i++)
			for (int j =y1[0]; j <= y1[3]; j++)
			{
				point p = new point(i , j);
				if(map.containsKey(p))
				{System.out.println("YES"); return ;}
			}

		System.out.println("NO");

	}

	public static int neededFromLeft(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				c ++;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return c;
	}

	public static int neededFromRight(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;
		boolean f=true;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f=false;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return st.size();
	}

	public static boolean fromBoth(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		boolean f1=true ,f2=true ;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f1 =false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)f2 = false ;

		if(f1==false && f2==false)
			return true ;
		else
			return false;
	}

	public static boolean isRegular(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				return false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)return false ; else return true ;
	}

	public static int gcdExtended(int a, int b)
	{
		// Base Case
		if (a == 0)
		{
			x = 0;
			y = 1;
			return b;
		}

		//int x1=1, y1=1; // To store results of recursive call
		int gcd = gcdExtended(b%a, a);

		// Update x and y using results of recursive
		// call
		long x1 = y - (b/a) * x;
		long y1 = x;
		x = x1 ;
		y = y1 ;

		return gcd;
	}

	static int even(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2==0)
				return current ;
		}
		return -1;
	}
	static int odd(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2!=0)
				return current ;
		}
		return -1;
	}
	static long pow(long base, int exp) {
		long res = 1;
		while(exp > 0) {
			if(exp % 2 == 1) {
				res = (res * base) % mod;
			}

			base = (base * base) % mod;
			exp /= 2;
		}

		return res;
	}
	public static long solve(int k1, long k2)
	{
		long x   = 1l*k2*(pow(2, k1)-1) ;
		return x%(1000000007) ;
	}

	public static long getN(long x)
	{
		long n = (long) Math.sqrt(x*2) ;
		long y = n*(n+1)/2;
		if(y==x)
			return n ;
		else if(y>x)
			return n ;
		else
			for (long i = n; ; i++)
			{
				y = i*(i+1)/2 ;
				if(y>=x)
					return i ;

			}	}

	public static void dfss(int root , int len)
	{
		visited[root]=true ;
		if(ends[root] && root!=0) lens[root] = len ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c= (int) adj[root].get(i) ;
			if(visited[c]==false)
				dfss(c, len+1);
		}
	}

	public static void pr(int root ,  int seed){
		visited[root] = true ;
		int dv = adj[root].size()-1 ;
		if(root==0) dv++ ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c = (int)adj[root].get(i) ;
			seeds[c]=dv*seed ;
		}

		for (int i = 0; i < adj[root].size() ; i++)
		{
			int c = (int)adj[root].get(i) ;
			if(visited[c]==false)
				pr(c , seeds[c]);

		}

	}

	public static String concatinate(String s ,int n)
	{
		if(s.length()==n)
			return s ;
		else return concatinate("0"+s, n) ;
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

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

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

	public static long getGCD(long n1, long n2) {
		if (n2 == 0) {
			return n1;
		}
		return getGCD(n2, n1 % n2);
	}

	public static int cnt1(int mat[][])  //how many swaps to be a 1 matrix
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2==0 && mat[i][j]==0)
					c++;
				if(x%2!=0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}
	public static int cnt0(int mat[][])
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2!=0 && mat[i][j]==0)
					c++;
				if(x%2==0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}

	public static boolean canFit2(int x1, int y1 , int x2 , int y2 , int x3 , int y3){
		if(x1==x2)
			if(x1==x3)
				return true ;
			else
				return false ;
		else
			if(x1==x3)
				return false ;
			else
			{
				long a = 1l*(y2-y1)*(x3-x2) ;
				long b = 1l*(y3-y2)*(x2-x1) ;

				if(a==b)
					return true;
				else
					return false ;

			}

	}
	public static void shuffle(pair[] ss){
		if(ss.length==1)
			return ;
		for (int i = 0; i < ss.length; i++)
		{
			Random rand = new Random();

			int  n = rand.nextInt(ss.length-1) + 0;

			pair temp = ss[i] ;
			ss[i] = ss[n] ;
			ss[n] = temp ;
		}
	}
	public static int binary(ArrayList<pair> arr, int l, int r, long x)   /// begin by 0 and n-1
	{
		if (r>=l)
		{
			int mid = l + (r - l)/2;
			if (arr.get(mid).x== x)
				return mid;
			if (arr.get(mid).x> x)
				return binary(arr, l, mid-1, x);
			return binary(arr, mid+1, r, x);
		}
		return -1;
	}

	/// searching for the index of first elment greater than x
	public static int binary1(int[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid] <= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				low = mid + 1;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				high = mid;
			}
		}
		return low ; // return high ;
	}

	////// searching for last element less than X
	public static int binary2(pair[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid].x >= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				high=mid;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				low = mid+1 ;
			}
		}
		return low ; // return high ;
	}

	private static boolean triangle(int a, int b , int c){
		if(a+b>c && a+c>b && b+c>a)
			return true ;
		else
			return false ;
	}
	private static boolean segment(int a, int b , int c){
		if(a+b==c || a+c==b && b+c==a)
			return true ;
		else
			return false ;
	}
	private static int gcdThing(long a, long b) {
		BigInteger b1 = BigInteger.valueOf(a);
		BigInteger b2 = BigInteger.valueOf(b);
		BigInteger gcd = b1.gcd(b2);
		return gcd.intValue();
	}

	public static boolean is(int i){
		if(Math.log(i)/ Math.log(2) ==(int) (Math.log(i)/ Math.log(2)))
			return true ;
		if(Math.log(i)/ Math.log(3) ==(int) (Math.log(i)/ Math.log(3)) )
			return true ;
		if(Math.log(i)/ Math.log(6) ==(int) (Math.log(i)/ Math.log(6)) )
			return true ;

		return false;

	}
	public static boolean contains(int b[] , int x)
	{
		for (int i = 0; i < b.length; i++)
		{
			if(b[i]==x)
				return true ;
		}
		return false ;
	}
	public static int binary(long []arr , long target , int low , long shift) {
		int high = arr.length;
		while (low != high) {
			int mid = (low + high) / 2;
			if (arr[mid]-shift <= target) {
				low = mid + 1;
			}
			else {
				high = mid;
			}
		}
		return low ; // return high ;
	}
	public static boolean isLetter(char x){
		if(x+0 <=122 && x+0 >=97 )
			return true ;
		else if (x+0 <=90 && x+0 >=65 )
			return true ;
		else return false;
	}
	public static long getPrimes(long x ){
		if(x==2 || x==3 || x==1)
			return 2 ;
		if(isPrime(x))
			return 5 ;
		for (int i = 2; i*i<=x; i++)
		{
			if(x%i==0 && isPrime(i))
				return getPrimes(x/i) ;
		}
		return -1;
	}
	public static String solve11(String x){

		int n = x.length() ;
		String y = "" ;
		for (int i = 0; i < n-2; i+=2)
		{
			if(ifPalindrome(x.substring(i, i+2)))
				y+= x.substring(i, i+2) ;
			else
				break ;
		}
		return y+ solve11(x.substring(y.length(),x.length())) ;

	}
	public static String solve1(String x){
		String y = x.substring(0 , x.length()/2) ;
		return "" ;

	}
	public static String reverse(String x){
		String y ="" ;
		for (int i = 0; i < x.length(); i++)
		{
			y  = x.charAt(i) + y ;
		}
		return y ;
	}

	public static boolean ifPalindrome(String x){
		int numbers[] = new int[10] ;
		for (int i = 0; i < x.length(); i++)
		{
			int z = Integer.parseInt(x.charAt(i)+"") ;
			numbers[z] ++ ;
		}
		for (int i = 0; i < numbers.length; i++)
		{
			if(numbers[i]%2!=0)
				return false;
		}
		return true ;
	}

	public static int get(int n){
		return n*(n+1)/2 ;
	}
	//		public static long getSmallestDivisor( long y){
	//			if(isPrime(y))
	//				return -1;
	//
	//			for (long i = 2; i*i <= y; i++)
	//			{
	//				if(y%i ==0)
	//				{
	//					return i;
	//				}
	//			}
	//			return -1;
	//		}
	public static int lis( int[]a , int n){
		int lis[] = new int[n] ;
		Arrays.fill(lis,1) ;

		for(int i=1;i<n;i++)
			for(int j=0 ; j<i; j++)
				if (a[i]>a[j] &&  lis[i] < lis[j]+1)
					lis[i] = lis[j] + 1;

		int max = lis[0];

		for(int i=1; i<n ; i++)
			if (max < lis[i])
				max = lis[i] ;
		return (max);

		//			ArrayList<Integer> s = new ArrayList<Integer>() ;
		//			for (int i = n-1; i >=0; i--)
		//			{
		//				if(lis[i]==max)
		//				{
		//					s.add(a[i].z);
		//					max --;
		//				}
		//			}
		//
		//			for (int i = s.size()-1 ; i>=0 ;  i--)
		//			{
		//				System.out.print(s.get(i)+" ");
		//			}
		//
	}
	public static int calcDepth(Vertix node){
		if(node.depth>0) return node.depth;
		// meaning it has been updated before;
		if(node.parent != null)
			return 1+ calcDepth(node.parent);
		else
			return -1;
	}

	public static boolean isPrime (long num){
		if (num < 2) return false;
		if (num == 2) return true;
		if (num % 2 == 0) return false;
		for (int i = 3; i * i <= num; i += 2)
			if (num % i == 0) return false;
		return true;
	}

	public static ArrayList<Long> getDiv(Long n)
	{
		ArrayList<Long>  f = new ArrayList<Long>() ;

		while (n%2==0)
		{
			if(!f.contains(2))f.add((long) 2) ;
			n /= 2;
		}

		// n must be odd at this point.  So we can
		// skip one element (Note i = i +2)
		for (long i = 3; i <= Math.sqrt(n); i+= 2)
		{
			// While i divides n, print i and divide n
			while (n%i == 0)
			{
				if(!f.contains(i))f.add(i);
				n /= i;
			}
		}

		// This condition is to handle the case whien
		// n is a prime number greater than 2
		if (n > 2)
			if(!f.contains(n))f.add(n);

		return f ;

	}

	//		public static boolean dfs(Vertix v , int target){
	//			try{
	//				visited[v.i]= true ;
	//			} catch (NullPointerException e)
	//			{
	//				System.out.println(v.i);
	//			}
	//			if(v.i == target)
	//
	//				return true ;
	//			for (int i =0 ; i< v.neighbours.size() ; i++)
	//			{
	//
	//				Vertix child = v.neighbours.get(i) ;
	//				if(child.i == target){
	//					found = true  ;
	//				}
	//				if(visited[child.i]==false){
	//					found |= dfs(child, target) ;
	//				}
	//			}
	//			return found;
	//		}

	public static class Vertix{
		long i ;
		int depth ;
		ArrayList<Vertix> neighbours ;
		Vertix parent ;
		Vertix child ;

		public Vertix(long i){
			this.i = i ;
			this.neighbours = new ArrayList<Vertix> () ;
			this.parent = null ;
			depth =-1;
			this.child = null ;
		}
	}

	public static class pair implements Comparable<pair> {
		int x ;
		int y ;
		int i;

		public pair(int x, int y, int i ){

			this.x=x ;
			this.y =y ;
			this.i =i ;

		}

		@Override
		public int compareTo(pair p) {
			if(this.x > p.x)
				return 1 ;
			else if (this.x == p.x)
				return 0 ;
			else
				return -1 ;
		}

	}

	public static class pair2 implements Comparable<pair2>{
		int i ;
		int j ;
		int plus ;

		public pair2(int i , int j , int plus){
			this.i =i ;
			this.j = j ;
			this.plus = plus ;
		}

		@Override
		public int compareTo(pair2 p) {
			if(this.j > p.j)
				return 1 ;
			else if (this.j == p.j) return 0 ;
			else
				return -1 ;
		}

	}
	public static class point implements  Comparable<point>
	{
		int x, y ;
		public point(int x,int y){
			this.x=x ; this.y=y;
		}
		@Override
		public boolean equals(Object o) {

			// If the object is compared with itself then return true
			if (o == this) {
				return true;
			}

			/* Check if o is an instance of Complex or not
	          "null instanceof [type]" also returns false */
			if (!(o instanceof point)) {
				return false;
			}

			// typecast o to Complex so that we can compare data members
			point c = (point) o;

			// Compare the data members and return accordingly
			return Integer.compare(x, c.x) == 0
					&& Integer.compare(y, c.y) == 0;
		}
		@Override
		public int compareTo(point p) {
			if(this.x == p.x && this.y ==p.y)
				return 0 ;
			else
				return -1 ;
		}

		@Override
		public int hashCode()
		{
			return 15+x+(y%2) ;
		}

	}

}

import java.util.*;
 //taken from sanfoundary
public class Solution
{

    public static boolean onSegment(Point p, Point q, Point r)
    {
        if (q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x)
                && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y))
            return true;
        return false;
    }

    public static int orientation(Point p, Point q, Point r)
    {
        int val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);

        if (val == 0)
            return 0;
        return (val > 0) ? 1 : 2;
    }

    public static boolean doIntersect(Point p1, Point q1, Point p2, Point q2)
    {

        int o1 = orientation(p1, q1, p2);
        int o2 = orientation(p1, q1, q2);
        int o3 = orientation(p2, q2, p1);
        int o4 = orientation(p2, q2, q1);

        if (o1 != o2 && o3 != o4)
            return true;

        if (o1 == 0 && onSegment(p1, p2, q1))
            return true;

        if (o2 == 0 && onSegment(p1, q2, q1))
            return true;

        if (o3 == 0 && onSegment(p2, p1, q2))
            return true;

        if (o4 == 0 && onSegment(p2, q1, q2))
            return true;

        return false;
    }

    public static boolean isInside(Point polygon[], int n, Point p)
    {
        int INF = 10000;
        if (n < 3)
            return false;

        Point extreme = new Point(INF, p.y);

        int count = 0, i = 0;
        do
        {
            int next = (i + 1) % n;
            if (doIntersect(polygon[i], polygon[next], p, extreme))
            {
                if (orientation(polygon[i], p, polygon[next]) == 0)
                    return onSegment(polygon[i], p, polygon[next]);

                count++;
            }
            i = next;
        } while (i != 0);

        return (count & 1) == 1 ? true : false;
    }

    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        Point p1[] ;
        Point p2[] ;
        int n = 4,i;
        p1=new Point[4];
        p2=new Point[4];
        for(i=0;i<4;i++){
            p1[i]=new Point(sc.nextInt(),sc.nextInt());
        }
        for(i=0;i<4;i++){
            p2[i]=new Point(sc.nextInt(),sc.nextInt());
        }
        boolean b1[]=new boolean[4];
        boolean b2[]=new boolean[4];
        for(i=0;i<4;i++){
            b1[i]=isInside(p1, n, p2[i]);
            b2[i]=isInside(p2, n, p1[i]);
        }
        int x1=(p2[0].x+p2[2].x)/2;
        int y1=(p2[0].y+p2[2].y)/2;
        Point p = new Point(x1, y1);
        boolean flag1=isInside(p1, n, p);
        boolean flag=false;
        for(i=0;i<4;i++){
            if(b1[i]==true)
                flag=true;
            if(b2[i]==true)
                flag=true;
        }
        if(flag==true||flag1==true)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}
class Point
{
    int x, y;

    Point()
    {}

    Point(int p, int q)
    {
        x = p;
        y = q;
    }
}

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

public class C994{

	private void solve() throws Exception {
		Square degrees_0 = new Square(2*nextLong(), 2*nextLong(), 2*nextLong(), 2*nextLong(), 2*nextLong(), 2*nextLong(), 2*nextLong(), 2*nextLong());
		Square degrees_90 = new Square(2*nextLong(), 2*nextLong(), 2*nextLong(), 2*nextLong(), 2*nextLong(), 2*nextLong(), 2*nextLong(), 2*nextLong());
		boolean intersection = false;
		for(int i = 0; i < 4; i++) {
			intersection = intersection || degrees_90.isInside(degrees_0.x[i], degrees_0.y[i]);
		}
		for(int i = 0; i < 4; i++) {
			intersection = intersection || degrees_0.isInside(degrees_90.x[i], degrees_90.y[i]);
		}
		intersection = intersection || degrees_0.isInside((degrees_90.x[0]+degrees_90.x[2])/2, (degrees_90.y[0]+degrees_90.y[2])/2);
		if(intersection) out.println("YES");
		else out.println("NO");
	}

	class Square{
		long[] x;
		long[] y;

		long[] line01;
		long[] line32;

		long[] line12;
		long[] line30;

		public Square(long x0, long y0, long x1, long y1, long x2, long y2, long x3, long y3) {
			x = new long[] {x0,x1,x2,x3};
			y = new long[] {y0,y1,y2,y3};

			line01 = line(x[0], y[0], x[1], y[1]);
			line32 = line(x[3], y[3], x[2], y[2]);

			line12 = line(x[1], y[1], x[2], y[2]);
			line30 = line(x[0], y[0], x[3], y[3]);
		}

		boolean isInside(long x, long y) {
			return signedDistance(line01,x,y)*signedDistance(line32,x,y) <= 0 && signedDistance(line12,x,y)*signedDistance(line30,x,y) <= 0 ;
		}

		long signedDistance(long[] coef, long x, long y) {
			long A = coef[0];
			long B = coef[1];
			long C = coef[2];
			return A*x+B*y+C;
		}

		long[] line(long x1, long y1, long x2, long y2) {
			return new long[] {y1-y2, x2-x1, (x1-x2)*y1+x1*(y2-y1)};
		}
	}

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

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer tokenizer;

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			tokenizer = null;
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

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

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

	private float nextFloat() throws IOException {
		return Float.parseFloat(nextToken());
	}

	private String nextLine() throws IOException {
		return new String(in.readLine());
	}

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

}

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

/* spar5h */

//I hate geometry

public class cf3 implements Runnable{

	final static long mod = (long)1e9 + 7;
	final static double err = 1e-9;

	public void run() {

		InputReader s = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);

		double[] x1 = new double[4 + 1];
		double[] y1 = new double[4 + 1];

		for(int i = 0; i < 4; i++) {
			x1[i] = s.nextDouble(); y1[i] = s.nextDouble();
			x1[4] += x1[i]; y1[4] += y1[i];
		}

		x1[4] /= 4; y1[4] /= 4;

		double[] x2 = new double[4 + 1];
		double[] y2 = new double[4 + 1];

		for(int i = 0; i < 4; i++) {
			x2[i] = s.nextDouble(); y2[i] = s.nextDouble();
			x2[4] += x2[i]; y2[4] += y2[i];
		}

		x2[4] /= 4; y2[4] /= 4;

		boolean res = false;

		for(int i = 0; i <= 4; i++) {

			boolean b = true;

			if(Math.min(Math.min(x1[0], x1[1]), x1[2]) > x2[i])
				b = false;

			if(Math.max(Math.max(x1[0], x1[1]), x1[2]) < x2[i])
				b = false;

			if(Math.min(Math.min(y1[0], y1[1]), y1[2]) > y2[i])
				b = false;

			if(Math.max(Math.max(y1[0], y1[1]), y1[2]) < y2[i])
				b = false;

			if(b)
				res = true;
		}

		//rotate by 45 scaled to 1.41:1

		for(int i = 0; i <= 4; i++) {

			double x = x1[i] - y1[i];
			double y = x1[i] + y1[i];

			x1[i] = x; y1[i] = y;

			x = x2[i] - y2[i];
			y = x2[i] + y2[i];

			x2[i] = x; y2[i] = y;
		}

		for(int i = 0; i <= 4; i++) {

			boolean b = true;

			if(Math.min(Math.min(x2[0], x2[1]), x2[2]) > x1[i])
				b = false;

			if(Math.max(Math.max(x2[0], x2[1]), x2[2]) < x1[i])
				b = false;

			if(Math.min(Math.min(y2[0], y2[1]), y2[2]) > y1[i])
				b = false;

			if(Math.max(Math.max(y2[0], y2[1]), y2[2]) < y1[i])
				b = false;

			if(b)
				res = true;
		}

		if(res)
			w.println("YES");
		else
			w.println("NO");

		w.close();
	}

	static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next()
		{
			return readString();
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	public static void main(String args[]) throws Exception
	{
		new Thread(null, new cf3(),"cf3",1<<26).start();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by Arihant Jain on 6/16/2018.
 */
public class twoSquares {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String out[] = br.readLine().split(" ");
        int parallelX[] = new int[4];
        int parallelY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            parallelX[i/2] = Integer.parseInt(out[i]);
            parallelY[i/2] = Integer.parseInt(out[i+1]);
        }
        int x1 = Math.min(parallelX[0],parallelX[2]);
        int x2 = Math.max(parallelX[0], parallelX[2]);
        int y1 = Math.min(parallelY[0],parallelY[2]);
        int y2 = Math.max(parallelY[0], parallelY[2]);
        out = br.readLine().split(" ");
        int diagonalGivenX[] = new int[4];
        int diagonalGivenY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            diagonalGivenX[i/2] = Integer.parseInt(out[i]);
            diagonalGivenY[i/2] = Integer.parseInt(out[i+1]);
        }
        int xMin = 0;
        int xMax = 0;
        int yMin = 0;
        int yMax = 0;
        for (int i =1; i<4; i++) {
            if (diagonalGivenX[i]<diagonalGivenX[xMin])
                xMin = i;
            if (diagonalGivenX[i]>diagonalGivenX[xMax])
                xMax = i;
            if (diagonalGivenY[i]<diagonalGivenY[yMin])
                yMin = i;
            if (diagonalGivenY[i]>diagonalGivenY[yMax])
                yMax = i;
        }
        int[] diagonalX = new int[4];
        int[] diagonalY = new int[4];
        diagonalX[0] = diagonalGivenX[xMin];
        diagonalX[1] = diagonalGivenX[yMax];
        diagonalX[2] = diagonalGivenX[xMax];
        diagonalX[3] = diagonalGivenX[yMin];
        diagonalY[0] = diagonalGivenY[xMin];
        diagonalY[1] = diagonalGivenY[yMax];
        diagonalY[2] = diagonalGivenY[xMax];
        diagonalY[3] = diagonalGivenY[yMin];
        for (int i =0; i<4; i++) {
            if (diagonalX[i]>=x1 && diagonalX[i]<= x2 && diagonalY[i]>=y1 && diagonalY[i]<=y2) {
                System.out.println("YES");
                return;
            }
        }
        for (int i =0; i<4; i++) {
            int x = parallelX[i];
            int y = parallelY[i];
            if (y<=x+diagonalY[0]-diagonalX[0] && y<=-1*x+diagonalX[1]+diagonalY[1] && y>=x-diagonalX[2]+diagonalY[2] && y>=-1*x+diagonalX[3]+diagonalY[3]) {
                System.out.println("YES");
                return;
            }
        }
        int x = (x1+x2)/2;
        int y = (y1+y2)/2;
        if (y<=x+diagonalY[0]-diagonalX[0] && y<=-1*x+diagonalX[1]+diagonalY[1] && y>=x-diagonalX[2]+diagonalY[2] && y>=-1*x+diagonalX[3]+diagonalY[3]) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
}

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
import java.awt.geom.*;

@SuppressWarnings("unchecked")
public class P993A {

  final static int X = 0, Y = 1;

  public void run() throws Exception {
    int [][] rxy = new int [4][], xy = new int [4][];
    for (int i = 0; i < 4; rxy[i] = readInt(2), i++);
    for (int i = 0; i < 4;  xy[i] = readInt(2), i++);

    int minX = Math.min(Math.min(rxy[0][X], rxy[1][X]), Math.min(rxy[2][X], rxy[3][X])),
        maxX = Math.max(Math.max(rxy[0][X], rxy[1][X]), Math.max(rxy[2][X], rxy[3][X])),
        minY = Math.min(Math.min(rxy[0][Y], rxy[1][Y]), Math.min(rxy[2][Y], rxy[3][Y])),
        maxY = Math.max(Math.max(rxy[0][Y], rxy[1][Y]), Math.max(rxy[2][Y], rxy[3][Y]));

    Rectangle2D r = new Rectangle2D.Double(minX, minY, maxX - minX, maxY - minY);
    Line2D l = new Line2D.Double();

    for (int i = 0; i < 4; i++) {
      for (int j = i + 1; j < 4; j++) {
        l.setLine(xy[i][X], xy[i][Y], xy[j][X], xy[j][Y]);

        if (l.intersects(r)) {
          println("YES");
          return;
        }
      }
    }

    println("NO");
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P993A().run();
    br.close();
    pw.close();
    System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
  }

  static long startTime = System.currentTimeMillis();
  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

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

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }

  int gcd(int a, int b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  long gcd(long a, long b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  void shuffle(int [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      int t = a[i]; a[i] = a[j]; a[j] = t;
    }
  }

  void shuffle(long [] a) {
    Random r = new Random();
    for (int i = a.length - 1; i >= 0; i--) {
      int j = r.nextInt(a.length);
      long t = a[i]; a[i] = a[j]; a[j] = t;
    }
  }
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class C {
    private static final int MAX = 100;
    private static final int MIN = -100;

    private void solve() {
        int left = MAX;
        int right = MIN;
        int top = MAX;
        int bottom = MIN;
        for(int i = 0;i < 4;i++) {
            int x = nextInt();
            int y = nextInt();
            left = Math.min(left, x);
            right = Math.max(right, x);
            top = Math.min(top, y);
            bottom = Math.max(bottom, y);
        }

        int l = MAX;
        int r = MIN;
        int t = MAX;
        int b = MIN;
        for(int i = 0;i < 4;i++) {
            int x = nextInt();
            int y = nextInt();
            // 45度回転した座標
            l = Math.min(l, x + y);
            r = Math.max(r, x + y);
            t = Math.min(t, x - y);
            b = Math.max(b, x - y);
        }

        for(int i = left;i <= right;i++) {
            for(int j = top;j <= bottom;j++) {
                if (l <= i + j && i + j <= r && t <= i - j && i - j <= b) {
                    out.println("YES");
                    return;
                }
            }
        }
        out.println("NO");
    }

    public static void main(String[] args) {
        out.flush();
        new C().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
    class Point {
        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    int area(Point a, Point b, Point c) {
        return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
    }

    boolean intersect_1(int a, int b, int c, int d) {
        if (a > b) {
            int t = a;
            a = b;
            b = t;
        }
        if (c > d) {
            int t = c;
            c = d;
            d = t;
        }
        return Math.max(a, c) <= Math.min(b, d);
    }

    boolean intersect(Point a, Point b, Point c, Point d) {
        return intersect_1(a.x, b.x, c.x, d.x)
                && intersect_1(a.y, b.y, c.y, d.y)
                && area(a, b, c) * area(a, b, d) <= 0
                && area(c, d, a) * area(c, d, b) <= 0;
    }

    class line {
        int a, b, c;

        line(Point p, Point q) {
            a = p.y - q.y;
            b = q.x - p.x;
            c = -1 * (a * p.x + b * p.y);
        }

        int get(Point p) {
            return a * p.x + b * p.y + c;
        }
    }

    int sign(int x) {
        if (x > 0) return 1;
        if (x < 0) return -1;
        return 0;
    }

    public void solve() throws IOException {
        Point p1[] = new Point[4];
        Point p2[] = new Point[4];
        int mid1x = 0, mid2x = 0, mid1y = 0, mid2y = 0;
        int maxx = Integer.MIN_VALUE, maxy = Integer.MIN_VALUE, minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE;
        for (int i = 0; i < 4; i++) {
            p1[i] = new Point(2 * nextInt(), 2 * nextInt());
            maxx = Math.max(maxx, p1[i].x);
            minx = Math.min(minx, p1[i].x);
            maxy = Math.max(maxy, p1[i].y);
            miny = Math.min(miny, p1[i].y);
            if (i % 2 == 0) {
                mid1x += p1[i].x;
                mid1y += p1[i].y;
            }
        }
        for (int i = 0; i < 4; i++) {
            p2[i] = new Point(2 * nextInt(), 2 * nextInt());
            if (i % 2 == 0) {
                mid2x += p2[i].x;
                mid2y += p2[i].y;
            }
        }
        mid1x /= 2;
        mid1y /= 2;
        mid2x /= 2;
        mid2y /= 2;
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                if (intersect(p1[i], p1[(i + 1) % 4], p2[j], p2[(j + 1) % 4])) {
                    out.print("YES");
                    return;
                }
            }
        }
        if (mid2x >= minx && mid2x <= maxx && mid2y >= miny && mid2y <= maxy) {
            out.print("YES");
            return;
        }
        line l1 = new line(p2[0], p2[1]), l2 = new line(p2[3], p2[2]);
        Point mid = new Point(mid1x, mid1y);

        line l3 = new line(p2[1], p2[2]);
        line l4 = new line(p2[0], p2[3  ]);
        if (sign(l1.get(mid)) != sign(l2.get(mid)) && sign(l3.get(mid)) != sign(l4.get(mid))) {
            out.print("YES");
            return;
        }

        out.print("NO");

    }

    BufferedReader br;
    StringTokenizer sc;
    PrintWriter out;

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Main().run();
    }

    public void run() throws IOException {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    public String nextToken() throws IOException {
        while (sc == null || !sc.hasMoreTokens()) {
            try {
                sc = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return sc.nextToken();
    }

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

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

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

import java.awt.geom.Line2D;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        ArrayList<Point> square1 = new ArrayList<>();
        ArrayList<Point> square2 = new ArrayList<>();
        StringTokenizer st = new StringTokenizer(in.readLine());
        for (int i = 0; i < 4; i++) {
            int x = Integer.parseInt(st.nextToken());
            int y = Integer.parseInt(st.nextToken());
            square1.add(new Point(x,y));
        }
        st = new StringTokenizer(in.readLine());
        for (int i = 0; i < 4; i++) {
            int x = Integer.parseInt(st.nextToken());
            int y = Integer.parseInt(st.nextToken());
            square2.add(new Point(x,y));
        }
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                Point a1 = square1.get(i);
                Point a2 = square1.get((i+1)%4);
                Point b1 = square2.get(j);
                Point b2 = square2.get((j+1)%4);
                if (Line2D.linesIntersect(a1.x, a1.y, a2.x, a2.y, b1.x, b1.y, b2.x, b2.y)) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                Point a1 = square1.get(i);
                Point b1 = square2.get(j);
                Point b2 = square2.get((j+1)%4);
                if (Line2D.linesIntersect(a1.x, a1.y, a1.x, 200, b1.x, b1.y, b2.x, b2.y)) {
                    for (int k = 0; k < 4; k++) {
                        if (k == j) {
                            continue;
                        }
                        Point c1 = square2.get(k);
                        Point c2 = square2.get((k+1)%4);
                        if (Line2D.linesIntersect(a1.x, a1.y, a1.x, -200, c1.x, c1.y, c2.x, c2.y)) {
                            System.out.println("YES");
                            return;
                        }
                    }
                }
            }
        }
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                Point a1 = square2.get(i);
                Point b1 = square1.get(j);
                Point b2 = square1.get((j+1)%4);
                if (Line2D.linesIntersect(a1.x, a1.y, a1.x, 200, b1.x, b1.y, b2.x, b2.y)) {
                    for (int k = 0; k < 4; k++) {
                        if (k == j) {
                            continue;
                        }
                        Point c1 = square1.get(k);
                        Point c2 = square1.get((k+1)%4);
                        if (Line2D.linesIntersect(a1.x, a1.y, a1.x, -200, c1.x, c1.y, c2.x, c2.y)) {
                            System.out.println("YES");
                            return;
                        }
                    }
                }
            }
        }
        System.out.println("NO");
    }

    static class Point {
        int x, y;
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

}
/*

 */

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

public class Main {

    public static void main(String[] args) throws IOException {
        InputReader input_reader = new InputReader(System.in);
        OutputWriter output_writer = new OutputWriter(System.out);
        ProblemSolver solver = new ProblemSolver();
        solver.solve(input_reader, output_writer);
        output_writer.flush();
        output_writer.close();
    }

    private static class ProblemSolver {

        boolean isInside(double x, double y, double[] s_x, double[] s_y) {
            return Math.min(s_x[0],s_x[2])<=x && x<=Math.max(s_x[2],s_x[0])
                    && Math.min(s_y[0],s_y[2])<=y && y<=Math.max(s_y[2],s_y[0]);
        }

        void rotate(double[] s_x, double[] s_y, double f_x, double f_y) {

            for (int i=0;i<s_x.length;i++) {
                s_x[i] = s_x[i]-f_x;
                s_y[i] = s_y[i]-f_y;
            }
            for (int i=0;i<s_x.length;i++) {
                double x = s_x[i];
                double y = s_y[i];
                double r_x, r_y;
                double onebyroot2 = 1/Math.sqrt(2.0);
                r_x = x*onebyroot2+(-1.0*(y*onebyroot2));
                r_y = y*onebyroot2-(-1.0*(x*onebyroot2));
                s_x[i] = r_x;
                s_y[i] = r_y;
            }
            for (int i=0;i<s_x.length;i++) {
                s_x[i] = s_x[i]+f_x;
                s_y[i] = s_y[i]+f_y;
            }
        }

        boolean doesIntersect(double[] s1_x, double[] s1_y, double[] s2_x, double[] s2_y) {
            for (int i=0;i<4;i++) {
                if (isInside(s2_x[i], s2_y[i], s1_x, s1_y)) {
                    return true;
                }
            }
            double c_x = Math.min(s2_x[0],s2_x[2]) + ((Math.max(s2_x[0], s2_x[2])-Math.min(s2_x[0], s2_x[2]))/(2.0d));
            double c_y = Math.min(s2_y[0],s2_y[2]) + ((Math.max(s2_y[0], s2_y[2])-Math.min(s2_y[0], s2_y[2]))/(2.0d));
            if (isInside(c_x, c_y, s1_x, s1_y)) {
                return true;
            }
            return false;
        }

        public void solve(InputReader input, OutputWriter output)
                throws IOException {
            double[] s1_x = new double[4];
            double[] s1_y = new double[4];
            double[] s2_x = new double[4];
            double[] s2_y = new double[4];
            for (int i=0;i<4;i++) {
                s1_x[i] = input.nextInt()*1.0d;
                s1_y[i] = input.nextInt()*1.0d;
            }
            for (int i=0;i<4;i++) {
                s2_x[i] = input.nextInt()*1.0d;
                s2_y[i] = input.nextInt()*1.0d;
            }
            boolean intersects = false;
            if (doesIntersect(s1_x, s1_y, s2_x, s2_y)) {
                intersects = true;
            }
            if (!intersects) {
                double f_x = Math.min(s1_x[0],s1_x[2]) + ((Math.max(s1_x[0], s1_x[2])-Math.min(s1_x[0], s1_x[2]))/(2.0d));
                double f_y = Math.min(s1_y[0],s1_y[2]) + ((Math.max(s1_y[0], s1_y[2])-Math.min(s1_y[0], s1_y[2]))/(2.0d));
                rotate(s1_x, s1_y, f_x, f_y);
                rotate(s2_x, s2_y, f_x, f_y);
                if (doesIntersect(s2_x, s2_y, s1_x, s1_y)) {
                    intersects = true;
                }
            }
            if (intersects) {
                output.printLine("YES");
            } else {
                output.printLine("NO");
            }
            output.flush();
        }
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

    private static class OutputWriter {

        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object...objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object...objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }
    }
}

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

/*
TASK: CFA
LANG: JAVA
 */
public class CFA {
    static int[] xa , ya , xb , yb;
    static int xmax , xmin , ymax , ymin;
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in);
        xa = new int[4];
        ya = new int[4];
        xb = new int[4];
        yb = new int[4];
        xmax = -1000;
        ymax = -1000;
        xmin = 1000;
        ymin = 1000;
        for(int i = 0; i < 4; i++){xa[i] = in.nextInt(); ya[i] = in.nextInt();}
        for(int i = 0; i < 4; i++){xb[i] = in.nextInt(); yb[i] = in.nextInt();}
        for(int i = 0;i < 4; i++){
            xmax = Math.max(xmax, xa[i]);
            ymax = Math.max(ymax , ya[i]);
            xmin = Math.min(xmin , xa[i]);
            ymin = Math.min(ymin , ya[i]);
        }
        Arrays.sort(xb);
        Arrays.sort(yb);
        int x , y;
        for(int i = 0;i <= xb[1] - xb[0]; i++){
            for(int j = -i; j <= i; j++){
                x = i + xb[0];
                y = j + yb[1];
                if(x <= xmax && x >= xmin && y <= ymax && y >= ymin){
                    System.out.println("YES");
                    return;
                }
                x = xb[3] - i;
                y = j + yb[1];
                if(x <= xmax && x >= xmin && y <= ymax && y >= ymin){
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");

    }
    static class FastScanner {
        final private int BUFFER_SIZE = 1 << 20;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public FastScanner(InputStream stream) {
            din = new DataInputStream(stream);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public FastScanner(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        int[] nextIntArray(int N) throws IOException {
            int[] arr = new int[N];
            for (int i = 0; i < N; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        String nextLine() throws IOException {
            int c = read();
            while (c != -1 && isEndline(c))
                c = read();
            if (c == -1) {
                return null;
            }
            StringBuilder res = new StringBuilder();
            do {
                if (c >= 0) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isEndline(c));
            return res.toString();
        }

        public String nextLine(int maxLen) throws IOException {
            byte[] buf = new byte[maxLen]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        boolean isEndline(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        String next() throws Exception {
            int c = readOutSpaces();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg) c = read();

            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        private int readOutSpaces() throws IOException {
            while (true) {
                if (bufferPointer == bytesRead) fillBuffer();
                int c = buffer[bufferPointer++];
                if (!isSpaceChar(c)) {
                    return c;
                }
            }
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }
}

import java.util.*;
import java.awt.*;
import java.awt.geom.*;

public class Main {

    static final double eps = 1e-6;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while( sc.hasNext() ) {

                int x1[] = new int[4];
                int y1[] = new int[4];
                int x2[] = new int[4];
                int y2[] = new int[4];

                for( int i=0; i<4; i++ ) {
                        x2[i] = sc.nextInt();
                        y2[i] = sc.nextInt();
                }

                for( int i=0; i<4; i++ ) {
                        x1[i] = sc.nextInt();
                        y1[i] = sc.nextInt();
                }

                Polygon P = new Polygon( x1, y1, 4 );

                Polygon R = new Polygon( x2, y2, 4 );

                boolean fl = false;

                Line2D a[] = new Line2D[4];
                Line2D b[] = new Line2D[4];

                for( int i=0; i<4; i++ ) {
                        a[i] = new Line2D.Double( x1[i], y1[i], x1[(i + 1 ) % 4], y1[(i + 1 ) % 4] );
                        b[i] = new Line2D.Double( x2[i], y2[i], x2[(i + 1 ) % 4], y2[(i + 1 ) % 4] );
                }

                for( int i=0; i<4; i++ ) {
                        for( int j=0; j<4; j++ ) {
                                if( a[i].intersectsLine( b[j] ) ) {
                                        fl = true;
                                }
                                if( b[j].intersectsLine( a[i] ) ) {
                                        fl = true;
                                }
                        }
                }

                for( int i=0; i<4; i++ ) {
                        if( R.contains( x1[i], y1[i] ) ) {
                                fl = true;
                        }
                        if( P.contains( x2[i], y2[i] ) ) {
                                fl = true;
                        }
                }

                if( fl == true ) {
                        System.out.println( "YES" );
                }
                else {
                        System.out.println( "NO" );
                }

        }
    }
}

import java.util.*;
public class Main {
	static class node
	{
		int x;
		int y;
	}
	static node a[]=new node[5];
	static node b[]=new node[5];
	static int vis[][]=new int [300][300];
	static class cmp implements Comparator <node>
	{
		public int compare(node a,node b)
		{
			if(a.x-b.x==0)
				return a.y-b.y;
			else
				return a.x-b.x;
		}
	}
 public static void main(String args[])
 {
	 Scanner input=new Scanner(System.in);

         	 for(int i=0;i<4;i++)a[i]=new node();
         	for(int i=0;i<4;i++)
         	{
         		a[i].x=input.nextInt();a[i].y=input.nextInt();
         	}
         	 for(int i=0;i<4;i++)b[i]=new node();
         	 for(int i=0;i<4;i++)
         	 {
         		 b[i].x=input.nextInt();b[i].y=input.nextInt();

         	 }

         Arrays.sort(a,0,4,new cmp());
         	 Arrays.sort(b,0,4,new cmp());
         	 for(int i=a[0].x;i<=a[2].x;i++)
         	 {
         		 for(int j=a[0].y;j<=a[1].y;j++)
         			 vis[i+100][j+100]=1;
         	 }
         	int cnt=0,blag=0;
            for(int i=b[0].x;i<b[1].x;i++,cnt++)
              for(int j=b[0].y-cnt;j<=b[0].y+cnt;j++)
                if(vis[i+100][j+100]==1)
                  blag=1;
            for(int i=b[1].x;i<=b[3].x;i++,cnt--)
              for(int j=b[0].y-cnt;j<=b[0].y+cnt;j++)
                if(vis[i+100][j+100]==1)
                  blag=1;
            if(blag==0)System.out.println("NO");
            else
            	System.out.println("YES");

 }
}

//package round488;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class A {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = 4;
		int[][] coa = new int[n][];
		for(int i = 0;i < n;i++){
			coa[i] = new int[]{ni(), ni()};
		}
		int[][] cob = new int[n][];
		for(int i = 0;i < n;i++){
			cob[i] = new int[]{ni(), ni()};
		}

		for(int i = 0;i < n;i++){
			for(int j = 0;j < n;j++){
				if(hasCommonPoint(
						coa[i], coa[(i+1)%n],
						cob[j], cob[(j+1)%n]
								)){
					out.println("YES");
					return;
				}
			}
		}

		for(int i = 0;i < n;i++){
			int sum = 0;
			for(int j = 0;j < n;j++){
				sum += ccw(coa[j], coa[(j+1)%n], cob[i]);
			}
			if(sum == n || sum == -n){
				out.println("YES");
				return;
			}
		}
		for(int i = 0;i < n;i++){
			int sum = 0;
			for(int j = 0;j < n;j++){
				sum += ccw(cob[j], cob[(j+1)%n], coa[i]);
			}
			if(sum == n || sum == -n){
				out.println("YES");
				return;
			}
		}
		out.println("NO");
	}

	public static int ccw(int[] a, int[] b, int[] t){ return Long.signum((long)(t[0]-a[0])*(b[1]-a[1])-(long)(b[0]-a[0])*(t[1]-a[1])); }

	public static boolean hasCommonPoint(int[] a, int[] b, int[] c, int[] d){ return hasCommonPoint(a[0], a[1], b[0], b[1], c[0], c[1], d[0], d[1]);}

	public static boolean hasCommonPoint(long ax, long ay, long bx, long by, long cx, long cy, long dx, long dy)
	{
		long c1 = (cx-ax)*(by-ay)-(cy-ay)*(bx-ax);
		long c2 = (dx-ax)*(by-ay)-(dy-ay)*(bx-ax);
		if(c1 < 0 && c2 < 0 || c1 > 0 && c2 > 0)return false;
		long d1 = (ax-cx)*(dy-cy)-(ay-cy)*(dx-cx);
		long d2 = (bx-cx)*(dy-cy)-(by-cy)*(dx-cx);
		if(d1 < 0 && d2 < 0 || d1 > 0 && d2 > 0)return false;
		if(c1 == 0 && c2 == 0 && d1 == 0 && d2 == 0){
			if(ax == bx && ay == by){
				return (cx-ax)*(dx-ax)+(cy-ay)*(dy-ay) <= 0;
			}else{
				long posc = (cx-ax)*(bx-ax)+(cy-ay)*(by-ay);
				long posd = (dx-ax)*(bx-ax)+(dy-ay)*(by-ay);
				long den = (bx-ax)*(bx-ax)+(by-ay)*(by-ay);
	//			return Math.max(0, Math.min(posc, posd)) <= Math.min(den, Math.max(posc, posd));
	//			return Math.min(posc, posd) <= den && 0 <= Math.max(posc, posd);
				return (posc <= den || posd <= den) && (0 <= posc || 0 <= posd);
			}
		}
		return true;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new A().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

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

public class A {
	public static void main(String[] args) throws IOException {

		/**/
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		/*/
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream("src/a.in"))));
		/**/

		int a1 = 1000;
		int a2 = -1000;
		int b1 = 1000;
		int b2 = -1000;
		int a3 = 1000;
		int a4 = -1000;
		int b3 = 1000;
		int b4 = -1000;
		for (int i = 0; i < 4; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			a1 = Math.min(a1, a);
			a2 = Math.max(a2, a);
			b1 = Math.min(b1, b);
			b2 = Math.max(b2, b);
		}
		for (int i = 0; i < 4; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			a3 = Math.min(a3, a+b);
			a4 = Math.max(a4, a+b);
			b3 = Math.min(b3, a-b);
			b4 = Math.max(b4, a-b);
		}
		for (int i = a1; i <= a2; i++) {
			for (int j = b1; j <= b2; j++) {
				if (i+j>=a3&&i+j<=a4&&i-j>=b3&&i-j<=b4) {
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
}

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

public class A {
	FastScanner in;
	PrintWriter out;
	boolean systemIO = true;

	public static void quickSort(int[] a, int from, int to) {
		if (to - from <= 1) {
			return;
		}
		int i = from;
		int j = to - 1;
		int x = a[from + (new Random()).nextInt(to - from)];
		while (i <= j) {
			while (a[i] < x) {
				i++;
			}
			while (a[j] > x) {
				j--;
			}
			if (i <= j) {
				int t = a[i];
				a[i] = a[j];
				a[j] = t;
				i++;
				j--;
			}
		}
		quickSort(a, from, j + 1);
		quickSort(a, j + 1, to);
	}

	public class Point {
		int x;
		int y;

		public Point(int x, int y) {
			this.x = x;
			this.y = y;
		}
	}

	public class Square {
		int minx;
		int miny;
		int maxx;
		int maxy;

		public Square(int minx, int miny, int maxx, int maxy) {
			this.minx = minx;
			this.miny = miny;
			this.maxx = maxx;
			this.maxy = maxy;
		}
	}

	public void solve() {
		Point[] p1 = new Point[4];
		Point[] p2 = new Point[4];
		for (int i = 0; i < p2.length; i++) {
			p1[i] = new Point(in.nextInt(), in.nextInt());
		}
		for (int i = 0; i < p2.length; i++) {
			p2[i] = new Point(in.nextInt(), in.nextInt());
		}
		int minx = Integer.MAX_VALUE;
		int miny = Integer.MAX_VALUE;
		int maxx = Integer.MIN_VALUE;
		int maxy = Integer.MIN_VALUE;
		for (int i = 0; i < p1.length; i++) {
			minx = Math.min(minx, p1[i].x);
			miny = Math.min(miny, p1[i].y);
			maxx = Math.max(maxx, p1[i].x);
			maxy = Math.max(maxy, p1[i].y);
		}
		Point p0 = new Point((minx + maxx) / 2, (miny + maxy) / 2);
		Square a = new Square(minx, miny, maxx, maxy);
		minx = Integer.MAX_VALUE;
		miny = Integer.MAX_VALUE;
		maxx = Integer.MIN_VALUE;
		maxy = Integer.MIN_VALUE;
		for (int i = 0; i < p2.length; i++) {
			minx = Math.min(minx, p2[i].x);
			miny = Math.min(miny, p2[i].y);
			maxx = Math.max(maxx, p2[i].x);
			maxy = Math.max(maxy, p2[i].y);
		}
		Point p = new Point((minx + maxx) / 2, (miny + maxy) / 2);
		Square b = new Square(minx, miny, maxx, maxy);
		for (int i = 0; i < p2.length; i++) {
			if (p2[i].x >= a.minx && p2[i].x <= a.maxx && p2[i].y >= a.miny && p2[i].y <= a.maxy) {
				out.println("Yes");
				return;
			}
		}
		if (p.x >= a.minx && p.x <= a.maxx && p.y >= a.miny && p.y <= a.maxy) {
			out.println("Yes");
			return;
		}
		for (int i = 0; i < p2.length; i++) {
			int f = p1[i].y - p1[i].x;
			int s = p1[i].x + p1[i].y;
			if (f >= b.miny - (b.minx + b.maxx) / 2 && f <= b.maxy - (b.minx + b.maxx) / 2
					&& s >= b.miny + (b.minx + b.maxx) / 2 && s <= b.maxy + (b.minx + b.maxx) / 2) {
				out.println("Yes");
				return;
			}
		}
		int f = p0.y - p0.x;
		int s = p0.x + p0.y;
		if (f >= b.miny - (b.minx + b.maxx) / 2 && f <= b.maxy - (b.minx + b.maxx) / 2
				&& s >= b.miny + (b.minx + b.maxx) / 2 && s <= b.maxy + (b.minx + b.maxx) / 2) {
			out.println("Yes");
			return;
		}
		out.println("No");
	}

	public void run() {

		try {
			if (systemIO) {
				in = new FastScanner(System.in);
				out = new PrintWriter(System.out);
			} else {
				in = new FastScanner(new File("input.txt"));
				out = new PrintWriter(new File("output.txt"));
			}
			solve();

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

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
	public static void main(String[] args) {
		new A().run();
	}
}

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class C {

	static class Vector implements Comparable<Vector> {
	    public double x, y, z; //%
	    public double x0 = 0, y0 = 0, z0 = 0; //%
	    public static double epsilon = 1e-6; //%
	    public static Vector ORIGIN = new Vector(0, 0, 0); //%
	    public static int curId = 0; //%
	    public int id = Vector.curId++; //%

	    //#
	    // Constructor for normal vector
	    public Vector(double xx, double yy, double zz) {
	        x = xx;
	        y = yy;
	        z = zz;
	    }

	    // Constructor for 2d normal vector
	    public Vector(double xx, double yy) {
	        x = xx;
	        y = yy;
	        z = 0.0;
	    }

	    // Constructor for ray/line vector
	    public Vector(Vector a, Vector b) {
	        x = b.x - (x0 = a.x);
	        y = b.y - (y0 = a.y);
	        z = b.z - (z0 = a.z);
	    }

	    //$

	    //#
	    public static boolean equals(double a, double b) {
	        return Math.abs(a - b) < epsilon;
	    }

	    public Vector add(Vector v) {
	        return new Vector(x + v.x, y + v.y, z + v.z);
	    }

	    public Vector sub(Vector v) {
	        return new Vector(x - v.x, y - v.y, z - v.z);
	    }

	    public Vector scale(double s) {
	        return new Vector(new Vector(x0, y0, z0), new Vector((x * s) + x0, (y * s) + y0, (z * s) + z0));
	    }

	    public double mag() {
	        return Math.sqrt((x*x) + (y*y) + (z*z));
	    }

	    public double mag2() {
	        return dot(this);
	    }

	    public double dot(Vector v) {
	        return (x * v.x) + (y * v.y) + (z * v.z);
	    }

	    public Vector cross(Vector v) { return new Vector(y*v.z - z*v.y, z*v.x - x*v.z, x*v.y - y*v.x); }

	    public Vector normalize() {
	        double mag = mag();
	        return new Vector(new Vector(x0, y0, z0), new Vector((x / mag) + x0, (y / mag) + y0, (z / mag) + z0));
	    }
	    //$

	    // Returns this vector rotated 90 degrees clockwise //%
	    public Vector orthoCW() { return new Vector(y, -x, z); }

	    // Returns this vector rotated 90 degrees counter-clockwise //%
	    public Vector orthoCCW() { return new Vector(-y, x, z); }

	    //#
	    // Returns a rotated vector rotated on the XY plane around (c.x, c.y) (***Z value will NOT change***) //%
	    public Vector rotate(Vector c, double a) { return new Vector(new Vector(c.x, c.y, z0), this).rotate(a); }
	    //$

	    // Returns a rotated vector rotated on the XY plane around (x0, y0, z0) (***Z value will NOT change***) //%
	    public Vector rotate(double a) {
	        return new Vector(new Vector(x0, y0, z0), new Vector((x*Math.cos(a)) - (y*Math.sin(a)) + x0, (x*Math.sin(a)) + (y*Math.cos(a)) + y0, z + z0));
	    }

	    //#
	    public boolean pointOnLine(Vector p) {
	        if(equals(x, 0.0)) return equals(p.x, x0);
	        return equals(p.y - y0, (y/x) * (p.x - x0));
	    }

	    boolean intersects(Vector v) { return intersect(v) != null; }
	    //$

	    //#
	    // Returns a 2d vector of the intersection //%
	    // returns null if the lines don't intersect or are on top of each other //%
	    public Vector intersect(Vector v) {
	        Vector a = new Vector(x0, y0);
	        Vector c = new Vector(v.x0, v.y0);
	        return intersect(a, add(a), c, v.add(c));
	    }
	    //$

	    // Returns a 2d vector of the intersection of a -> b and c -> d //%
	    // Returns null if the lines are parallel //%
	    public static Vector intersect(Vector a, Vector b, Vector c, Vector d) {
	        double a1 = b.y - a.y, b1 = a.x - b.x, c1 = a1 * a.x + b1 * a.y;
	        double a2 = d.y - c.y, b2 = c.x - d.x, c2 = a2 * c.x + b2 * c.y;
	        double det = a1 * b2 - a2 * b1;
	        if (equals(det, 0)) return null;
	        return new Vector((b2 * c1 - b1 * c2) / det, (a1 * c2 - a2 * c1) / det);
	    }

	    //#
	    // Returns the point of intersection between this line and the line/vector v. //%
	    // Returns null if the lines are parallel or skew //%
	    public Vector intersect3D(Vector v) {
	        if(equals(cross(v).mag(), 0.0)) return null; //The lines are parallel
	        double s, t;
	        if(!equals(x, 0.0)) {
	            if(!equals(v.y, v.x * y / x)) {
	                s = y0 - v.y0 + (y * (v.x0 - x0) / x);
	                s /= v.y - (v.x * y / x);
	            } else if(!equals(v.z, v.x * z / x)) {
	                s = z0 - v.z0 + (z * (v.x0 - x0) / x);
	                s /= v.z - (v.x * z / x);
	            } else return null;
	            t = (v.x0 + (s * v.x) - x0) / x;
	        } else if(!equals(y, 0.0)) {
	            if(!equals(v.x, v.y * x / y)) {
	                s = x0 - v.x0 + (x * (v.y0 - y0) / y);
	                s /= v.x - (v.y * x / y);
	            } else if(!equals(v.z, v.y * z / y)) {
	                s = z0 - v.z0 + (z * (v.y0 - y0) / y);
	                s /= v.z - (v.y * z / y);
	            } else return null;
	            t = (v.y0 + (s * v.y) - y0) / y;
	        } else if(!equals(z, 0.0)) {
	            if(!equals(v.y, v.z * y / z)) {
	                s = y0 - v.y0 + (y * (v.z0 - z0) / z);
	                s /= v.y - (v.z * y / z);
	            } else if(!equals(v.x, v.z * x / z)) {
	                s = x0 - v.x0 + (x * (v.z0 - z0) / z);
	                s /= v.x - (v.z * x / z);
	            } else return null;
	            t = (v.z0 + (s * v.z) - z0) / z;
	        } else return null;
	        double newX = x0 + (t * x);
	        double newX2 = v.x0 + (s * v.x);

	        double newY = y0 + (t * y);
	        double newY2 = v.y0 + (s * v.y);

	        double newZ = z0 + (t * z);
	        double newZ2 = v.z0 + (s * v.z);

	        if(!equals(newX, newX2) || !equals(newY, newY2) || !equals(newZ, newZ2)) return null; //The lines are skew
	        return new Vector(newX, newY, newZ);
	    }
	    //$

	    // Gets angle between this vector and vector v (range: [0, pi] )
	    double angleBetween(Vector v) {
	        return Math.acos( Math.max(-1, Math.min(1, dot(v) / (mag() * v.mag()))) );
	    }

	    // Gets angle between this vector and vector v (range (-pi, pi] )
	    double angleTo(Vector v) {
	        // Can be changed to " > 0.0" to return -1 if the vectors are parallel //%
	        // (useful for checking if a point is to left/right OR on the line //%
	        if(this.cross(v).z >= 0.0)
	            return Math.acos( Math.max(-1.0, Math.min(1.0, this.dot(v) / (this.mag() * v.mag()))) );
	        return - Math.acos( Math.max(-1.0, Math.min(1.0, this.dot(v) / (this.mag() * v.mag()))) );
	    }

	    //#
	    // Returns only the sign of the angle between this vector and the vector v on the XY plane.
	    // +1 for to the left, -1 for to the left, and 0 for straight
	    int angleToSignum(Vector v) { return (int) Math.signum(cross(v).z); }
	    //$

	    //#
	    // Gets the value of sin(theta) and cos(theta) needed to rotate this vector to the vector v
	    // Only works on the XY plane currently
	    double[] getSinCosTo(Vector v) {
	        double mags = mag() * v.mag();
	        return new double[]{cross(v).z / mags, dot(v) / mags};
	    }
	    //$

	    //#
	    // Returns [0.0, 4.0] which allows these vectors to be sorted by angle
	    // 0.0 is a vector that is directly to the right
	    double getSortableAngleTo(Vector v) {
	        Vector r = v.sub(this);
	        double dot = r.dot(new Vector(1.0, 0.0)) / r.mag();
	        dot = 1.0 - dot;
	        if(r.y < 0.0)
	            dot = 4.0 - dot;
	        return dot;
	    }
	    //$

	    //#
	    // Checks if two vectors are orthogonal to each other
	    boolean isOrthogonal(Vector v) { return equals(this.dot(v), 0.0); }
	    //$

	    //#
	    // Checks if two vectors are in parallel
	    boolean isParallel(Vector v) { return equals(this.cross(v).mag(), 0.0); }
	    //$

	    /* Static functions using vectors */ //%

	    //#
	    // Returns the area of a triangle defined by three vertices
	    static double triangleArea(Vector p1, Vector p2, Vector p3) {
	        return p2.sub(p1).cross(p3.sub(p1)).mag() / 2.0;
	    }
	    //$

	    //#
	    // Returns only the sign of the angle between (p0, p1) and (p0, p2)
	    // +1 for to the left, -1 for to the right, and 0 for straight
	    static int angleToSignum(Vector p0, Vector p1, Vector p2) {
	        return new Vector(p0, p1).angleToSignum(new Vector(p0, p2));
	    }
	    //$

	    //#
	    // Check if a point is INSIDE a triangle defined by three points
	    static boolean pointInTriangle(Vector a, Vector b, Vector c, Vector p) {
	        int pab = (int) Math.signum(p.sub(a).cross(b.sub(a)).z);
	        int pbc = (int) Math.signum(p.sub(b).cross(c.sub(b)).z);
	        if (pab != pbc) return false;
	        int pca = (int) Math.signum(p.sub(c).cross(a.sub(c)).z);
	        return pab == pca;
	    }

	    // Checks if the edges of abc and def share ANY common points
	    // Does not check if one is contained in another
	    static boolean triTriIntersects(Vector a, Vector b, Vector c,
	            Vector d, Vector e, Vector f) {
	        if (segSegIntersects(a, b, d, e)) return true;
	        if (segSegIntersects(a, b, e, f)) return true;
	        if (segSegIntersects(a, b, f, d)) return true;

	        if (segSegIntersects(b, c, d, e)) return true;
	        if (segSegIntersects(b, c, e, f)) return true;
	        if (segSegIntersects(b, c, f, d)) return true;

	        if (segSegIntersects(a, c, d, e)) return true;
	        if (segSegIntersects(a, c, e, f)) return true;
	        if (segSegIntersects(a, c, f, d)) return true;

	        return false;
	    }
	    //$

	    //#
	    // Returns the distance from a point to a line defined by two points //%
	    static double pointLineDist(Vector l1, Vector l2, Vector p) {
	        Vector line = l2.sub(l1);  double l = line.dot(line);
	        double t = p.sub(l1).dot(line) / l;  return line.scale(t).add(l1).sub(p).mag();
	    }
	    //$

	    // Returns the distance from a point to a line segment defined by two points //%
	    static double pointLineSegDist(Vector l1, Vector l2, Vector p) {
	        Vector line = l2.sub(l1); double l = line.dot(line);
	        double t = p.sub(l1).dot(line) / l;
	        if (t < 0) return l1.sub(p).mag(); // Remove this line
	        else if(t > 1) return l2.sub(p).mag(); // & this for pointLineDist
	        return line.scale(t).add(l1).sub(p).mag();
	    }

	    // Returns the minimum distance between two line segments
	    static double lineLineDist(Vector p0, Vector p1, Vector p2, Vector p3) {
	        Vector u = p1.sub(p0), v = p3.sub(p2), w = p0.sub(p2);
	        double a = u.dot(u),  b = u.dot(v), c = v.dot(v),  d = u.dot(w);
	        double e = v.dot(w),  det = a * c - b * b;
	        if (det == 0) return pointLineDist(p0, p1, p2);
	        double s = (b * e - c * d) / det, t = (a * e - b * d) / det;
	        if (s >= 0 && s <= 1 && t >= 0 && t <= 1)
	            return w.add(u.scale(s).sub(v.scale(t))).mag();
	        double min = Math.min(pointLineDist(p0, p1, p2),
	                pointLineDist(p0, p1, p3));
	        return Math.min(Math.min(min, pointLineDist(p2, p3, p0)),
	                pointLineDist(p2, p3, p1));
	    }

	    // Returns true if the line segments a-b and c-d share any common points
	    // Add an epsilon if using doubles
	    static boolean segSegIntersects(Vector a, Vector b, Vector c, Vector d) {
	        Vector ab = b.sub(a), cd = d.sub(c);
	        int o1 = (int) Math.signum(ab.cross(c.sub(a)).z);
	        int o2 = (int) Math.signum(ab.cross(d.sub(a)).z);
	        int o3 = (int) Math.signum(cd.cross(a.sub(c)).z);
	        int o4 = (int) Math.signum(cd.cross(b.sub(c)).z);
	        if (o1 != o2 && o3 != o4) return true;
	        if (o1 == 0 && onSeg(a, b, c)) return true;
	        if (o2 == 0 && onSeg(a, b, d)) return true;
	        if (o3 == 0 && onSeg(c, d, a)) return true;
	        if (o4 == 0 && onSeg(c, d, b)) return true;
	        return false;
	    }

	    // Given 3 COLINEAR Vectors, returns if p is on the line segment a-b
	    // Add an epsilon if using doubles
	    static boolean onSeg(Vector a, Vector b, Vector p) {
	        return p.x <= Math.max(a.x, b.x) && p.x >= Math.min(a.x, b.x)
	                && p.y <= Math.max(a.y, b.y) && p.y >= Math.min(a.y, b.y);
	    }

	    // Returns a vector where p is reflected past the line l1 -> l2
	    static Vector reflect(Vector l1, Vector l2, Vector p) {
	        Vector line = l2.sub(l1);  double l = line.dot(line);
	        double t = p.sub(l1).dot(line) / l;
	        Vector q = line.scale(t).add(l1);
	        return q.add(q.sub(p));
	    }

	    // Reflects this vector across the vector n
	    Vector reflect(Vector n) {
	        n = n.normalize();
	        return sub(n.scale(2 * dot(n)));
	    }

	    //#
	    public int compareTo(Vector p) {
	        if (y == p.y) return Double.compare(x, p.x);
	        return Double.compare(y, p.y);
	    }
	    //$

	    //#
	    // Compares a and b with whichever comes first in a positive circular sweep
	    // Works best for longs
	    public static int compare(Vector a, Vector b) {
	        int res = 0;

	        if (a.x < 0) res += a.y >= 0 ? 1 : 2;
	        else if (a.y < 0) res += 3;

	        if (b.x < 0) res -= b.y >= 0 ? 1 : 2;
	        else if (b.y < 0) res -= 3;

	        if(res == 0) {
	            Vector cross = a.cross(b);  if(cross.z == 0) return 0;
	            if(cross.z > 0) return -1;  else  return 1;
	        }

	        return res;
	    }
	    //$

	    //#
	    public String toString() {
	        if(equals(x0, 0.0) && equals(y0, 0.0) && equals(z0, 0.0))
	            return String.format("<%.2f, %.2f, %.2f>", x, y, z);
	        return String.format("<%.2f + %.2ft, %.2f + %.2ft, %.2f + %.2ft>", x0, x, y0, y, z0, z);
	    } //$
	}

	static class LineSeg {
	    Vector a, b;

	    public LineSeg(Vector aa, Vector bb) {
	        a = aa;
	        b = bb;
	    }

	    public boolean pointOnLine(Vector p) {
	        Vector ap = p.sub(a);
	        Vector pb = b.sub(p);
	        return Vector.equals(ap.mag() + pb.mag(), b.sub(a).mag());
	    }

	    public boolean parallel(LineSeg l) {
	        return Vector.equals(l.b.sub(l.a).cross(b.sub(a)).mag(), 0.0);
	    }

	    public boolean parallel(Vector v) {
	        return Vector.equals(v.cross(b.sub(a)).mag(), 0.0);
	    }

	    //Returns a LineSegment rotated around point p with angle ang
	    public LineSeg rotate(Vector p, double ang) {
	        return new LineSeg(a.rotate(p, ang), b.rotate(p, ang));
	    }

	    //Checks if a Vector v from (x0, y0) to (x, y) intersects with this line segment
	    public boolean intersects(Vector v) {
	        Vector p = new Vector(a, b).intersect(v);
	        return p == null ? false : pointOnLine(p);
	    }

	    //Returns the point of intersection or null if the lines don't intersect
	    public Vector intersect(Vector v) {
	        Vector p = new Vector(a, b).intersect(v);
	        if(p == null || !pointOnLine(p)) return null;
	        return p;
	    }
	    //Checks if a Vector v from (x0, y0) to (x, y) intersects with this line segment
	    public boolean intersects(LineSeg l) {
	        Vector p = intersect(l);
	        return !(p == null);
	    }

	    //Returns the point of intersection or null if the lines don't intersect
	    public Vector intersect(LineSeg l) {
	        if(Vector.equals(a.sub(l.a).mag(), 0.0) || Vector.equals(a.sub(l.b).mag(), 0.0)) return a;
	        if(Vector.equals(b.sub(l.a).mag(), 0.0) || Vector.equals(b.sub(l.b).mag(), 0.0)) return b;
	        Vector p = new Vector(a, b).intersect(new Vector(l.a, l.b));
	        if(p == null || !pointOnLine(p) || !l.pointOnLine(p)) return null;
	        return p;
	    }

	    //#
	    public String toString() {
	        return "{ " + a + " to " + b + " }";
	    } //$
	}

	static class Polygon implements Comparable<Polygon> {
	    public ArrayList<Vector> vs; //%
	    public double area; //%

	    //# Constructs a polygon from an arraylist of vs in clockwise or counter-clockwise order
	    public Polygon(ArrayList<Vector> vss) {
	        vs = vss;
	        area = area();
	    }//$

	    //#Returns a polygon shifted over (d.x, d.y)
	    public Polygon translate(Vector d) {
	        ArrayList<Vector> nvs = new ArrayList<>(vs.size());
	        for(Vector v : vs)
	            nvs.add(v.add(d));
	        return new Polygon(nvs);
	    }//$

	    //#Returns a polygon rotated around (c.x, c.y) with angle a
	    public Polygon rotate(Vector c, double a) {
	        ArrayList<Vector> nvs = new ArrayList<>(vs.size());
	        for(Vector v : vs)
	            nvs.add(v.rotate(c, a));
	        return new Polygon(nvs);
	    }//$

	    //#Returns the area of this polygon
	    public double area() {
	        double area = 0.0;
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            area += (b.x - a.x) * (b.y + a.y);
	        }
	        return this.area = Math.abs(area) / 2.0;
	    }//$

	    public double signedArea() {
	        double area = 0.0;
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            area += (b.x - a.x) * (b.y + a.y);
	        }
	        return area / 2.0; //Do Math.abs(signedArea()) for area()
	    }

	    //#Returns the perimeter of this polygon
	    public double perimeter() {
	        double per = 0.0;
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            per += new Vector(a, b).mag();
	        }
	        return per;
	    }//$

	    //#Check if a point is INSIDE this polygon
	    public boolean pointInPolygon(Vector p) {
	        if(pointOnPerimeter(p)) return false;
	        double angle = 0.0;
	        Vector v = new Vector(p, p.add(new Vector(1d, 0d, 0d)));
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = new Vector(p, vs.get(i));
	            Vector b = new Vector(p, vs.get((i+1) % vs.size()));
	            angle += Math.atan2(a.cross(b).z, a.dot(b));
	        }
	        return Vector.equals(Math.abs(angle), Math.PI * 2.0);
	    }//$

	    //#Checks if a point is on the perimeter of this polygon
	    public boolean pointOnPerimeter(Vector p) {
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            LineSeg ab = new LineSeg(a, b);
	            if(ab.pointOnLine(p))
	                return true;
	        }
	        return false;
	    }//$

	    //#Returns the minimum distance to the given polygon
	    //Returns 0.0 if they intersect
	    public double distanceTo(Polygon poly) {
	        if(intersects(poly)) return 0.0;
	        double min = Double.MAX_VALUE;
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            for(Vector p : poly.vs)
	                min = Math.min(min, Vector.pointLineSegDist(a, b, p));
	        }
	        for(int i = 0; i < poly.vs.size(); i++) {
	            Vector a = poly.vs.get(i);
	            Vector b = poly.vs.get((i+1) % poly.vs.size());
	            for(Vector p : vs)
	                min = Math.min(min, Vector.pointLineSegDist(a, b, p));
	        }
	        return min;
	    }//$

	    //#
	    public boolean touches(Polygon poly) {
	        for(Vector p : poly.vs)
	            if(pointOnPerimeter(p))
	                return true;
	        for(Vector p : vs)
	            if(poly.pointOnPerimeter(p))
	                return true;
	        return false;
	    }//$

	    //#Returns true if the line segment INTERSECTS this polygon. Returns false if it doesn't or if their perimeters just touch
	    public boolean intersects(LineSeg l) {
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            LineSeg ab = new LineSeg(a, b);
	            if(ab.intersects(l))
	                if(!ab.pointOnLine(l.a) && !ab.pointOnLine(l.b) &&
	                   !l.pointOnLine(a) && !l.pointOnLine(b) ) //Check if they only touch
	                    return true;
	        }
	        return false;
	    }//$

	    //#Returns true if the polygon INTERSECTS with this polygon
	    public boolean intersects(Polygon poly) {
	        for(int i = 0; i < poly.vs.size(); i++) {
	            Vector a = poly.vs.get(i);
	            Vector b = poly.vs.get((i+1) % poly.vs.size());
	            LineSeg ab = new LineSeg(a, b);
	            if(intersects(ab))
	                return true;
	        }
	        return false;
	    }//$

	    //#Returns true IF this polygon entirely contains the polygon provided.
	    //Will return false in the special case that the two polygons are the same.
	    public boolean contains(Polygon poly) {
	        if(intersects(poly))
	            return false;
	        for(int i = 0; i < poly.vs.size(); i++) {
	            Vector a = poly.vs.get(i);
	            if(pointInPolygon(a))
	                return true;
	            else if(!pointOnPerimeter(a))
	                return false;
	        }
	        return true;
	    }//$

	    //# Assumes convex polygon
	    // Returns minimum width of this polygon if rotated optimally
	    public double getMinWidth() {
	        double minWidth = -1;
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            double max = 0.0;
	            for(Vector p : vs)
	                max = Math.max(Vector.pointLineDist(a, b, p), max);
	            if(minWidth < 0) minWidth = max;
	            else minWidth = Math.min(minWidth, max);
	        }
	        return minWidth;
	    }//$

	    // Gets center of mass of this simple polygon
	    //% O(n)
	    public Vector getCentroid() {
	        double a = 0.0, cx = 0.0, cy = 0.0;
	        int n = vs.size();
	        for(int i = 0; i < n; i++) {
	            Vector va = vs.get(i);
	            Vector vb = vs.get((i + 1) % n);
	            double temp = va.x * vb.y - vb.x * va.y;
	            a += temp;
	            cx += (va.x + vb.x) * temp;
	            cy += (va.y + vb.y) * temp;
	        }
	        a *= 3.0;
	        return new Vector(cx / a, cy / a);
	    }

	    //#
	    public int compareTo(Polygon poly) {
	        return Double.compare(area, poly.area);
	    }//$
	}

	class Square {
		Vector a, b, c, d;
		LineSeg[] segs;
		Square(Vector aa, Vector bb, Vector cc, Vector dd) {
			a = aa; b = bb; c = cc; d = dd;
			segs = new LineSeg[4];
			segs[0] = new LineSeg(a, b);
			segs[1] = new LineSeg(b, c);
			segs[2] = new LineSeg(c, d);
			segs[3] = new LineSeg(d, a);
		}
		boolean contains(Vector p) {
			double side = a.sub(c).mag();
			double longest = 0;
			longest = Math.max(longest, a.sub(p).mag());
			longest = Math.max(longest, b.sub(p).mag());
			longest = Math.max(longest, c.sub(p).mag());
			longest = Math.max(longest, d.sub(p).mag());
			return longest < side;
		}
	}

	public void solve(Scanner in, PrintWriter out) {
		/*
		boolean intersects = false;
		Square a = new Square(new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()));
		Square b = new Square(new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()));
		for(LineSeg s1 : a.segs) {
			for(LineSeg s2 : b.segs) {
				if(s1.intersects(s2)) {
					intersects = true;
				}
			}
		}
		System.out.println(a.contains(b.a));
		System.out.println(b.contains(a.a));
//		if(b.contains(a.a) || a.contains(b.a)) {
//			intersects = true;
//		}
		out.println(intersects ? "YES" : "NO");
		*/
		ArrayList<Vector> sq1 = new ArrayList<>();
		ArrayList<Vector> sq2 = new ArrayList<>();
		for(int i = 0; i < 4; ++i) {
			sq1.add(new Vector(in.nextDouble(), in.nextDouble()));
		}
		for(int i = 0; i < 4; ++i) {
			sq2.add(new Vector(in.nextDouble(), in.nextDouble()));
		}
		Polygon a = new Polygon(sq1);
		Polygon b = new Polygon(sq2);
		if(a.intersects(b) || a.touches(b) || a.contains(b) || b.contains(a)) {
			out.println("YES");
		} else {
			out.println("NO");
		}
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		new C().solve(in, out);
		in.close();
		out.close();
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author kessido
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            Point2D[] squarePoint = new Point2D[4];
            ConvexPolygon2D[] pols = new ConvexPolygon2D[2];
            for (int i = 0; i < 2; i++) {
                for (int j = 0; j < 4; j++) {
                    squarePoint[j] = new Point2D(in.NextInt(), in.NextInt());
                }
                pols[i] = new ConvexPolygon2D(squarePoint);
            }
            for (int i = 0; i < 2; i++) {
                for (Point2D p : pols[i].points) {
                    if (pols[1 ^ i].isInside(p, true)) {
                        out.println("YES");
                        return;
                    }
                }
            }
            for (Segment2D s1 : pols[0].segments)
                for (Segment2D s2 : pols[1].segments)
                    if (Segment2D.doIntersect(s1, s2)) {
                        out.println("YES");
                        return;
                    }
            out.println("NO");
        }

    }

    static class Segment2D {
        Point2D source;
        Point2D target;

        public Segment2D(Point2D source, Point2D target) {
            this.source = source;
            this.target = target;
        }

        public Segment2D(Segment2D segment2D) {
            this(segment2D.source, segment2D.target);
        }

        public Point2D getVector() {
            return Point2D.sub(target, source);
        }

        public static double orientation(Segment2D s, Point2D p) {
            Point2D vec = s.getVector();
            return vec.x * (p.y - s.source.y) - vec.y * (p.x - s.source.x);
        }

        private static boolean onSegment(Point2D p, Segment2D s) {
            return p.x <= Math.max(s.source.x, s.target.x) && p.x >= Math.min(s.source.x, s.target.x) &&
                    p.y <= Math.max(s.source.y, s.target.y) && p.y >= Math.min(s.source.y, s.target.y);
        }

        private static int sign(double d) {
            if (d == 0) return 0;
            if (d < 0) return -1;
            return 1;
        }

        public static boolean doIntersect(Segment2D s1, Segment2D s2) {
            int o1 = sign(orientation(s1, s2.source));
            int o2 = sign(orientation(s1, s2.target));
            int o3 = sign(orientation(s2, s1.source));
            int o4 = sign(orientation(s2, s1.target));

            if (o1 != o2 && o3 != o4)
                return true;

            return (o1 == 0 && onSegment(s2.source, s1))
                    || (o2 == 0 && onSegment(s2.target, s1)) || (o3 == 0 && onSegment(s1.source, s2)) || (o4 == 0 && onSegment(s1.target, s2));
        }

    }

    static class ConvexPolygon2D extends Polygon2D {
        public ConvexPolygon2D(Point2D[] points) {
            super(points);
            for (int i = 0; i < segments.length; i++) {
                double ore = Segment2D.orientation(segments[i], points[(i + 2) % points.length]);
                if (ore < 0) {
                    reverseOrientation();
                    break;
                } else if (ore > 0) break;
            }
        }

        public boolean isInside(Point2D p, boolean includeBoundary) {
            for (int i = 0; i < segments.length; i++) {
                double orientation = Segment2D.orientation(segments[i], p);
                if (orientation < 0 || (orientation == 0 && (!includeBoundary))) return false;
            }
            return true;
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine(), " \t\n\r\f,");
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int NextInt() {
            return Integer.parseInt(next());
        }

    }

    static class Polygon2D {
        public Point2D[] points;
        public Segment2D[] segments;

        public Polygon2D(Point2D[] points) {
            assert (points.length > 2);
            this.points = points.clone();
            segments = new Segment2D[points.length];
            for (int i = 0; i < points.length; i++) {
                segments[i] = new Segment2D(points[(i + 1) % points.length], points[i]);
            }
        }

        public void reverseOrientation() {
            Point2D[] points1 = new Point2D[points.length];
            points1[0] = points[0];
            for (int i = 0; i < points.length; i++) {
                points1[i] = points[points.length - i - 1];
            }
            points = points1;
            for (int i = 0; i < segments.length; i++) {
                segments[i] = new Segment2D(points[(i + 1) % points.length], points[i]);
            }
        }

    }

    static class Point3D implements Comparable<Point3D> {
        public double x;
        public double y;
        public double z;

        public Point3D(Point3D other) {
            setCoordinates(other);
        }

        public Point3D(double x, double y, double z) {
            setCoordinates(x, y, z);
        }

        public void setCoordinates(double x, double y, double z) {
            this.x = x;
            this.y = y;
            this.z = z;
        }

        public void setCoordinates(Point3D other) {
            setCoordinates(other.x, other.y, other.z);
        }

        public int compareTo(Point3D o) {
            int xC = Double.compare(x, o.x);
            if (xC != 0) return xC;
            int yC = Double.compare(y, o.y);
            if (yC != 0) return yC;
            return Double.compare(z, o.z);
        }

        public boolean equals(Object obj) {
            if (!(obj instanceof Point3D)) return false;
            return compareTo((Point3D) obj) == 0;
        }

    }

    static class Point2D implements Comparable<Point2D> {
        public double x;
        public double y;

        public Point2D(Point2D other) {
            setCoordinates(other);
        }

        public Point2D(double x, double y) {
            setCoordinates(x, y);
        }

        public static Point2D sub(Point2D p1, Point2D p2) {
            Point2D p = new Point2D(p1);
            p.sub(p2);
            return p;
        }

        public void setCoordinates(double x, double y) {
            this.x = x;
            this.y = y;
        }

        public void setCoordinates(Point2D other) {
            setCoordinates(other.x, other.y);
        }

        public void sub(Point2D other) {
            x -= other.x;
            y -= other.y;
        }

        public int compareTo(Point2D o) {
            int xC = Double.compare(x, o.x);
            if (xC != 0) return xC;
            return Double.compare(y, o.y);
        }

        public boolean equals(Object obj) {
            if (!(obj instanceof Point3D)) return false;
            return compareTo((Point2D) obj) == 0;
        }

    }
}

import java.util.*;
public class TwoSquares {
	static class Coord{
		int x, y;
		Coord(int a, int b){
			this.x = a;
			this.y = b;
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Coord[] s1 = new Coord[4];
		Coord[] s2 = new Coord[4];
		ArrayList<Integer> mx = new ArrayList<Integer>();
		ArrayList<Integer> my = new ArrayList<Integer>();
		for (int i=0; i<4; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			mx.add(x);
			my.add(y);
			s1[i] = new Coord(x, y);
		}
		Set<Integer> xv = new HashSet<Integer>();
		Set<Integer> yv = new HashSet<Integer>();
		int cx = 0;
		int cy = 0;
		for (int i=0; i<4; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			if (xv.contains(x)) cx = x;
			else xv.add(x);
			if (yv.contains(y)) cy = y;
			else yv.add(y);
			s2[i] = new Coord(x, y);
		}
		if (cx<=Collections.max(mx)&&cx>=Collections.min(mx)&&cy<=Collections.max(my)&&cy>=Collections.min(my)) {
			System.out.println("YES");
			return;
		}
		for (Coord c : s2) {
			if (c.x<=Collections.max(mx)&&c.x>=Collections.min(mx)&&c.y<=Collections.max(my)&&c.y>=Collections.min(my)) {
				System.out.println("YES");
				return;
			}
		}
		for (int i=0; i<4; i++) {
			s1[i] = new Coord(s1[i].x+s1[i].y, s1[i].x-s1[i].y);
		}for (int i=0; i<4; i++) {
			s2[i] = new Coord(s2[i].x+s2[i].y, s2[i].x-s2[i].y);
		}
		mx.clear();
		my.clear();
		for (int i=0; i<4; i++) {
			mx.add(s2[i].x);
			my.add(s2[i].y);
		}
		for (Coord c : s1) {
			if (c.x<=Collections.max(mx)&&c.x>=Collections.min(mx)&&c.y<=Collections.max(my)&&c.y>=Collections.min(my)) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}

}

import java.util.*;
public class TwoSquares {
    public static final double EPS = 1e-7;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] sq1X = new int[4];
        int[] sq1Y = new int[4];
        int[] sq2X = new int[4];
        int[] sq2Y = new int[4];
        int[] sq1XC = new int[4];
        int[] sq1YC = new int[4];
        int[] sq2XC = new int[4];
        int[] sq2YC = new int[4];
        for(int i = 0; i < 4; i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            sq1X[i] = x;
            sq1Y[i] = y;
            sq1XC[i] = x;
            sq1YC[i] = y;
        }
        for(int i = 0; i < 4; i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            sq2X[i] = x;
            sq2Y[i] = y;
            sq2XC[i] = x;
            sq2YC[i] = y;
        }
        //print(sq1X);
        ///print(sq1Y);
        //print(sq2X);
        //print(sq2Y);
        Arrays.sort(sq1XC);
        Arrays.sort(sq1YC);
        Arrays.sort(sq2XC);
        Arrays.sort(sq2YC);
        //check 45 deg square in first
        for (int i = 0; i < 4; i++) {
            int x = sq2X[i];
            int y = sq2Y[i];
            if (x >= sq1XC[0] && x <= sq1XC[2] && y>=sq1YC[0] && y<=sq1YC[2]) {
                System.out.println("yES");
                System.exit(0);
            }
        }
        //Check center of 45 square
        double cX = ((double)sq2XC[0]+(double)sq2XC[3])/2;
        double cY = ((double)sq2YC[0]+(double)sq2YC[3])/2;
        //System.out.println(cX + " " + cY);
        if (cX >= (double)sq1XC[0]  && cX <= (double)sq1XC[2] && cY >= (double)sq1YC[0] && cY <= (double)sq1YC[2]) {
            System.out.println("YeS");
            System.exit(0);
        }
        //Rotate squares
        for (int i = 0; i < 4; i++) {
            int x = sq1X[i];
            int y = sq1Y[i];
            sq1X[i] = x+y;
            sq1Y[i] = x-y;
            sq1XC[i] = x+y;
            sq1YC[i] = x-y;
            x = sq2X[i];
            y = sq2Y[i];
            sq2X[i] = x+y;
            sq2Y[i] = x-y;
            sq2XC[i] = x+y;
            sq2YC[i] = x-y;
        }
        Arrays.sort(sq2XC);
        Arrays.sort(sq2YC);
        Arrays.sort(sq1XC);
        Arrays.sort(sq1YC);
        //Do same check again
        for (int i = 0; i < 4; i++) {
            int x = sq1X[i];
            int y = sq1Y[i];
            if (x >= sq2XC[0] && x <= sq2XC[2] && y>=sq2YC[0] && y<=sq2YC[2]) {
                System.out.println("YEs");
                System.exit(0);
            }
        }
        //Check center of 45 square
        cX = ((double)sq1XC[0]+(double)sq1XC[3])/2;
        cY = ((double)sq1YC[0]+(double)sq1YC[3])/2;
        if (cX >= (double)sq2XC[0]  && cX <= (double)sq2XC[2] && cY >= (double)sq2YC[0] && cY <= (double)sq2YC[2]) {
            System.out.println("YES");
            System.exit(0);
        }
        System.out.println("NO");

    }
    public static void print(int[] arr) {
        StringBuilder stringBuilder = new StringBuilder();
        for(int i = 0; i < 4; i++) {
            stringBuilder.append(arr[i]);
            stringBuilder.append(" ");
        }
        System.out.println(stringBuilder.toString());
    }

}

// Don't place your source in a package
import java.util.*;
import java.lang.*;
import java.io.*;
	   import java.awt.Polygon;
import java.awt.geom.Area;

// Please name your class Main
public class poly {
	static boolean onSegment(int Pix,int Piy , int Pjx,int Pjy , int Qx,int Qy)
	{
	    if((Qx - Pix) * (Pjy - Piy) == (Pjx - Pix) * (Qy - Piy)  //叉乘
	       //保证Q点坐标在pi,pj之间
	       && Math.min(Pix , Pjx) <= Qx && Qx <= Math.max(Pix , Pjx)
	       && Math.min(Piy , Pjy) <= Qy && Qy <= Math.max(Piy , Pjy))
	        return true;
	    else
	        return false;
	}

	public static void main (String[] args) throws java.lang.Exception {
		Scanner s=new Scanner(System.in);

		int[] x=new int[8];
		int[] y=new int[8];
		x[0]=s.nextInt();
		y[0]=s.nextInt();
		x[1]=s.nextInt();
		y[1]=s.nextInt();
		x[2]=s.nextInt();
		y[2]=s.nextInt();
		x[3]=s.nextInt();
		y[3]=s.nextInt();

        Polygon p = new Polygon(new int[]{x[0],x[1],x[2],x[3]},new int[]{y[0],y[1],y[2],y[3]},4);
        x[4]=s.nextInt();
		y[4]=s.nextInt();
		x[5]=s.nextInt();
		y[5]=s.nextInt();
		x[6]=s.nextInt();
		y[6]=s.nextInt();
		x[7]=s.nextInt();
		y[7]=s.nextInt();

        Polygon p1 = new Polygon(new int[]{x[4],x[5],x[6],x[7]},new int[]{y[4],y[5],y[6],y[7]},4);

        for(int i=0;i<4;i++){
        	for(int j=4;j<8;j++){
        		if(x[i]==x[j] && y[i]==y[j]){
        			System.out.println("YES");
        			return;
        		}
        	}
        }

        for(int i=0;i<4;i++){

        		for(int k=4;k<8;k++){
        			for(int l=4;l<8;l++){
        				if(k!=l){
        					if(onSegment(x[k], y[k],x[l], y[l], x[i], y[i])){
        						System.out.println("YES");
        						return;
        					}
        				}
        			}
        		}

        }

        for(int i=4;i<8;i++){

        		for(int k=0;k<4;k++){
        			for(int l=0;l<4;l++){
        				if(k!=l){
        					if(onSegment(x[k], y[k],x[l], y[l], x[i], y[i])){
        						System.out.println("YES");
        						return;
        					}
        				}
        			}
        		}

        }
        Area area = new Area(p);
        area.intersect(new Area(p1));
        //area.contains(x[0],y1);

        //System.out.println(area.contains(0,0));
        if(area.isEmpty()){
        	System.out.println("NO");
        }else{
        	System.out.println("YES");
        }
        //System.out.println(area.isEmpty());
	}
}

import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

import static java.lang.Math.*;

public class Main implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(),"Main",1<<26).start();
    }
    public void run() {
        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);

        int minx = Integer.MAX_VALUE, maxx = Integer.MIN_VALUE, miny = Integer.MAX_VALUE, maxy = Integer.MIN_VALUE;

        for(int i = 0; i < 4; ++i) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            minx = min(minx, x);
            miny = min(miny, y);
            maxx = max(maxx, x);
            maxy = max(maxy, y);
        }

        int x[] = new int[4];
        int y[] = new int[4];
        for(int i = 0; i < 4; ++i) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        int midx, midy;

        if(x[0] == x[2]) {
            midx = x[0];
            midy = y[1];
        }
        else {
            midx = x[1];
            midy = y[0];
        }

        int dist = abs(x[0] - midx) + abs(y[0] - midy);

        for(int i = -100; i <= 100; ++i) {
            for(int j = -100; j <= 100; ++j) {
                if(i >= minx && i <= maxx && j >= miny && j <= maxy && (abs(i - midx) + abs(j - midy) <= dist)) {
                    w.print("YES");
                    w.close();
                    return;
                }
            }
        }

        w.print("NO");

        w.close();
    }
}
class Point {
    int x, y;
    Point(int a, int b) {
        x = a;
        y = b;
    }
}

import java.util.ArrayList;
import java.util.Scanner;
import java.lang.StringBuilder;
import java.util.Arrays;
import java.util.Stack;
//maintain: array on vertices
//a[i]:
public class Test10   {

    public static void main(String[] Args)   {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();
        int f = sc.nextInt();
        int g = sc.nextInt();
        int h = sc.nextInt();
        int minX = a;
        int maxX = 0;
        if (c != a) maxX = c;
        if (e != a) maxX = e;
        if (g != a) maxX = g;
        if (maxX < minX)   {
            a = minX;
            minX = maxX;
            maxX = a;
        }
        int minY = b;
        int maxY = 0;
        if (d != b) maxY = d;
        if (f != b) maxY = f;
        if (h != b) maxY = h;
        if (maxY < minY)   {
            b = minY;
            minY = maxY;
            maxY = b;
        }
        int a1 = sc.nextInt();
        int b1 = sc.nextInt();
        int c1 = sc.nextInt();
        int d1 = sc.nextInt();
        int e1 = sc.nextInt();
        int f1 = sc.nextInt();
        int g1 = sc.nextInt();
        int h1 = sc.nextInt();
        int cX = (a1 + c1 + e1 + g1)/4;
        int cY = (b1 + d1 + f1 + h1)/4;
        int l = Math.abs(cX - a1) + Math.abs(cY - b1);
        boolean ans = false;
        for (int i = minX; i <= maxX; i++)   {
            for (int j = minY; j <= maxY; j++)   {
                if (i + j >= cX + cY - l && i + j <= cX + cY + l)  {
                    if (i - j >= cX - cY - l && i - j <= cX - cY + l) ans = true;
                }
            }
        }
        if (ans) System.out.println("YES"); else System.out.println("NO");
    }
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        new Solver().run(1);
    }
}

class Solver {

    private BufferedReader reader = null;
    private StringTokenizer st = null;

    private Point[][] points = new Point[4][4];
    private boolean intersectionFound = false;

    public void run(int inputType) throws Exception {
        if (inputType == 0)
            reader = new BufferedReader(new FileReader("input.txt"));
        else
            reader = new BufferedReader(new InputStreamReader(System.in));

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < 4; ++i) {
            points[0][i] = new Point(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < 4; ++i) {
            points[1][i] = new Point(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        for (int i = 0; i < 2; ++i) {
            for (int j = 0; j < 4; ++j) {

                int nextSq = (i + 1) % 2;
                int res1 = crossProductSign(points[nextSq][0], points[nextSq][1], points[i][j]);
                int res2 = crossProductSign(points[nextSq][1], points[nextSq][2], points[i][j]);
                int res3 = crossProductSign(points[nextSq][2], points[nextSq][3], points[i][j]);
                int res4 = crossProductSign(points[nextSq][3], points[nextSq][0], points[i][j]);

                if ((res1 == 0 && inside(points[nextSq][0], points[nextSq][1], points[i][j]))
                        || (res2 == 0 && inside(points[nextSq][1], points[nextSq][2], points[i][j]))
                        || (res3 == 0 && inside(points[nextSq][2], points[nextSq][3], points[i][j]))
                        || (res4 == 0 && inside(points[nextSq][3], points[nextSq][0], points[i][j]))) {

                    intersectionFound = true;
                    break;
                }

                if (res1 == res2 && res2 == res3 && res3 == res4) {
                    intersectionFound = true;
                    break;
                }
            }

            if (intersectionFound)
                break;
        }

        if (!intersectionFound) {

            for (int i = 0; i < 4; ++i) {
                for (int j = 0; j < 4; ++j) {

                    if (linesIntersect(points[0][i], points[0][(i + 1) % 2], points[1][j], points[1][(j + 1) % 2])) {
                        intersectionFound = true;
                        break;
                    }
                }

                if (intersectionFound)
                    break;
            }
        }

        if (intersectionFound)
            System.out.println("YES");
        else
            System.out.println("NO");

        reader.close();
    }

    boolean linesIntersect(Point p1, Point p2, Point p3, Point p4) {

        boolean res1 = crossProductSign(p1, p2, p4) != crossProductSign(p1, p2, p3);
        boolean res2 = crossProductSign(p3, p4, p1) != crossProductSign(p3, p4, p2);

        return res1 && res2;
    }

    boolean inside(Point p1, Point p2, Point p3) {
        int xhigh = Math.max(p2.x, p1.x);
        int xlow = Math.min(p2.x, p1.x);
        int yhigh = Math.max(p2.y, p1.y);
        int ylow = Math.min(p2.y, p1.y);

        return p3.x >= xlow && p3.x <= xhigh && p3.y >= ylow && p3.y <= yhigh;
    }

    int crossProductSign(Point p1, Point p2, Point p3) {
        int res = (p2.x - p1.x) * (p3.y - p1.y) - (p2.y - p1.y) * (p3.x - p1.x);

        if (res < 0)
            return -1;

        if (res > 0)
            return 1;

        return 0;
    }

    class Point {
        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}

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

public class C {
    static BufferedReader br;
    static StringTokenizer st;
    static PrintWriter out;

    public static void main(String[] args) {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        solve();
        out.close();
    }

    public static void solve() {
        Point[] firstSquare = new Point[4];
        Point[] secondSquare = new Point[4];
        boolean flag = false;
        for(int i = 0; i < 4; i++) {
            firstSquare[i] = new Point(nextInt(), nextInt());
        }
        for(int i = 0; i < 4; i++)
            secondSquare[i] = new Point(nextInt(), nextInt());
        for(int x = -100; x < 100; x++) {
            for(int y = -100; y < 100; y++) {
                Point p = new Point(x, y);
                if(isInsideSquare(firstSquare, p) && isInsideSquare(secondSquare, p)) {
                    flag = true;
                    break;
                }
            }
            if (flag)
                break;
        }
        if (flag) {
            out.println("YES");
        } else {
            out.println("NO");
        }
    }

    static boolean isInsideSquare(Point[] square, Point p) {
        int[] distance = new int[4];
        for(int i = 0; i < 4; i++)
            distance[i] = distanceFromALine(p, square[i], square[(i + 1) % 4]);
        int sideLength = (int) (Math.pow((square[0].x - square[1].x), 2) + Math.pow((square[0].y - square[1].y), 2));
        if(sideLength % (distance[0] + distance[2]) == 0 && sideLength % (distance[1] + distance[3]) == 0)
            return true;
        return false;
    }

    static int distanceFromALine(Point p, Point p1, Point p2) {
        return Math.abs(((p2.y - p1.y) * p.x) - ((p2.x - p1.x) * p.y) + (p2.x * p1.y) - (p2.y * p1.x));
    }

    static class Point {
        int x;
        int y;
        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    private static int binarySearch(int i, int[] arr, int low) {
        int high = arr.length - 1;
        while (low <= high) {
            int mid = (low + high) / 2;
            if (arr[mid] == i)
                return mid;
            if (arr[mid] < i) {
                low = mid + 1;
            } else {
                high = mid - 1;
            }
        }
        return -1;
    }

    static String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static long nextLong() {
        return Long.parseLong(next());
    }

    static String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }

}

// CodeForces Round #799 C Fountains training TODO

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class TwoSquares {

	class Point {
		int x,y;
	}

	Point []a;
	Point []b;
	boolean intersect;

	private void readData(BufferedReader bin) throws IOException {
		String s = bin.readLine();
		String []ss = s.split(" ");
		a = new Point[4];
		b = new Point[4];
		for (int i=0; i<4; i++) {
			a[i] = new Point();
			b[i] = new Point();
		}
		a[0].x = Integer.parseInt(ss[0]);
		a[0].y = Integer.parseInt(ss[1]);
		a[1].x = Integer.parseInt(ss[2]);
		a[1].y = Integer.parseInt(ss[3]);
		a[2].x = Integer.parseInt(ss[4]);
		a[2].y = Integer.parseInt(ss[5]);
		a[3].x = Integer.parseInt(ss[6]);
		a[3].y = Integer.parseInt(ss[7]);
		s = bin.readLine();
		ss = s.split(" ");
		b[0].x = Integer.parseInt(ss[0]);
		b[0].y = Integer.parseInt(ss[1]);
		b[1].x = Integer.parseInt(ss[2]);
		b[1].y = Integer.parseInt(ss[3]);
		b[2].x = Integer.parseInt(ss[4]);
		b[2].y = Integer.parseInt(ss[5]);
		b[3].x = Integer.parseInt(ss[6]);
		b[3].y = Integer.parseInt(ss[7]);
	}

	void printRes() {
		System.out.println(intersect ? "YES" : "NO");
	}

	Point []bb = new Point[4];
	int amnx=1000111,amny=1000111,amxx=-1000222,amxy=-1000222;
	int mnx=1000111,mny=1000111,mxx=-1000222,mxy=-1000222;
	void countAA() {
		for (int i=0; i<4; i++) {
			amnx = Math.min(amnx, a[i].x);
			amny = Math.min(amny, a[i].y);
			amxx = Math.max(amxx, a[i].x);
			amxy = Math.max(amxy, a[i].y);
		}
	}

	boolean insideA(int x, int y) {
		boolean insx = amnx <= x && x <= amxx;
		boolean insy = amny <= y && y <= amxy;
		return insx && insy;
	}
	void countBB() {
		for (int i=0; i<4; i++) {
			bb[i] = new Point();
			bb[i].x = b[i].x + b[i].y;
			bb[i].y = b[i].x - b[i].y;
			if (mnx > bb[i].x) {
				mnx = bb[i].x;
			}
			mny = Math.min(mny, bb[i].y);
			mxx = Math.max(mxx, bb[i].x);
			mxy = Math.max(mxy, bb[i].y);
		}
	}

	boolean insideB(int x, int y) {
		int cx = x+y;
		int cy = x-y;
		boolean insx = mnx <= cx && cx <= mxx;
		boolean insy = mny <= cy && cy <= mxy;
		return insx && insy;
	}

	private void calculate() {
		countAA();
		countBB();
		for (int i=0; i<4; i++) {
			if (insideB(a[i].x, a[i].y)) {
				intersect = true;
				return;
			}
		}
		for (int i=0; i<4; i++) {
			if (insideA(b[i].x, b[i].y)) {
				intersect = true;
				return;
			}
		}
		int bcx = (b[0].x + b[2].x)/2;
		int bcy = (b[0].y + b[2].y)/2;
		if (insideA(bcx, bcy)) {
			intersect = true;
			return;
		}
		intersect = false;
	}

	public static void main(String[] args) throws IOException {
		// BufferedReader bin = new BufferedReader(new FileReader("cactus.in"));
		BufferedReader bin = new BufferedReader(
				new InputStreamReader(System.in));
		TwoSquares l = new TwoSquares();
		l.readData(bin);
		l.calculate();
		l.printRes();
	}
}

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

    public class Twosq
    {
    	public static void main(String[] args) throws IOException
    	{
    		Scanner sc = new Scanner(System.in);
    		int x1 = 100;
    		int x2 = -100;
    		int y1 = 100;
    		int y2 = -100;
    		int x3 = 100;
    		int x4 = -100;
    		int y3 = 100;
    		int y4 = -100;
    		for (int i = 0; i < 4; i++)
    		{
    			int a = sc.nextInt();
    			int b = sc.nextInt();
    			x1 = Math.min(x1, a);
    			x2 = Math.max(x2, a);
    			y1 = Math.min(y1, b);
    			y2 = Math.max(y2, b);
    		}
    		for (int i = 0; i < 4; i++)
    		{
    			int a = sc.nextInt();
    			int b = sc.nextInt();
    			x3 = Math.min(x3, a+b);
    			x4 = Math.max(x4, a+b);
    			y3 = Math.min(y3, a-b);
    			y4 = Math.max(y4, a-b);
    		}
    		for (int i = x1; i <= x2; i++)

    		{
    			for (int j = y1; j <= y2; j++)
    			{
    				if (i+j>=x3&&i+j<=x4&&i-j>=y3&&i-j<=y4)
    				{
    					System.out.println("YES");
    					return;
    				}
    			}
    		}
    		System.out.println("NO");
    	}
    }

//package com.prituladima.codeforce.contests;//package com.prituladima.codeforce;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Created by prituladima on 6/16/18.
 */
public class C994A {

    public class Point {
        int x;
        int y;

        public Point nextPoint() throws IOException {
            x = nextInt();
            y = nextInt();
            return this;
        }

        public Point rotate45() {
            int buf = x;
            x = y + x;
            y = buf - y;
            return this;
        }
    }

    private void solve() throws IOException {

        Point p1 = new Point().nextPoint();
        Point p2 = new Point().nextPoint();
        Point p3 = new Point().nextPoint();
        Point p4 = new Point().nextPoint();

        Point s1 = new Point().nextPoint();
        Point s2 = new Point().nextPoint();
        Point s3 = new Point().nextPoint();
        Point s4 = new Point().nextPoint();

        int y1 = Math.max(Math.max(p1.y, p2.y), p3.y);
        int y0 = Math.min(Math.min(p1.y, p2.y), p3.y);

        int x1 = Math.max(Math.max(p1.x, p2.x), p3.x);
        int x0 = Math.min(Math.min(p1.x, p2.x), p3.x);

        int midX = (s1.x + s2.x + s3.x + s4.x)/4;
        int midY = (s1.y + s2.y + s3.y + s4.y)/4;

        String ans = "NO";
        if(x0 <= s1.x && s1.x <= x1 && y0 <= s1.y && s1.y <= y1){
            ans = "YES";
        }
        if(x0 <= s2.x && s2.x <= x1 && y0 <= s2.y && s2.y <= y1){
            ans = "YES";
        }
        if(x0 <= s3.x && s3.x <= x1 && y0 <= s3.y && s3.y <= y1){
            ans = "YES";
        }

        if(x0 <= s4.x && s4.x <= x1 && y0 <= s4.y && s4.y <= y1){
            ans = "YES";
        }

        if(x0 <= midX && midX <= x1 && y0 <= midY && midY <= y1){
            ans = "YES";
        }

        p1 = p1.rotate45();
        p2 = p2.rotate45();
        p3 = p3.rotate45();
        p4 = p4.rotate45();

        s1 = s1.rotate45();
        s2 = s2.rotate45();
        s3 = s3.rotate45();
        s4 = s4.rotate45();

        midX = (p1.x + p2.x + p3.x + p4.x)/4;
        midY = (p1.y + p2.y + p3.y + p4.y)/4;

        y1 = Math.max(Math.max(s1.y, s2.y), s3.y);
        y0 = Math.min(Math.min(s1.y, s2.y), s3.y);

        x1 = Math.max(Math.max(s1.x, s2.x), s3.x);
        x0 = Math.min(Math.min(s1.x, s2.x), s3.x);
        if(x0 <= p1.x && p1.x <= x1 && y0 <= p1.y && p1.y <= y1){
            ans = "YES";
        }
        if(x0 <= p2.x && p2.x <= x1 && y0 <= p2.y && p2.y <= y1){
            ans = "YES";
        }
        if(x0 <= p3.x && p3.x <= x1 && y0 <= p3.y && p3.y <= y1){
            ans = "YES";
        }

        if(x0 <= p4.x && p4.x <= x1 && y0 <= p4.y && p4.y <= y1){
            ans = "YES";
        }

        if(x0 <= midX && midX <= x1 && y0 <= midY && midY <= y1){
            ans = "YES";
        }

        System.out.println(ans);

    }

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

    StringTokenizer tokenizer;
    BufferedReader reader;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

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

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

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

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

    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextInt();
        return arr;
    }

    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextLong();
        return arr;
    }

    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextDouble();
        return arr;
    }

}

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

public class A {
    FastScanner in;
    PrintWriter out;

    class O {
        int xmin, xmax, ymin, ymax;

        O() {
            xmin = Integer.MAX_VALUE;
            ymin = Integer.MAX_VALUE;
            xmax = Integer.MIN_VALUE;
            ymax = Integer.MIN_VALUE;
            for (int i = 0; i < 4; i++) {
                int x =in.nextInt();
                int y = in.nextInt();
                xmin = Math.min(xmin, x);
                xmax = Math.max(xmax, x);
                ymin = Math.min(ymin, y);
                ymax = Math.max(ymax, y);
            }
        }

        boolean inside(int x, int y) {
            return x >= xmin && x <= xmax && y >= ymin && y <= ymax;
        }

        boolean inside2(int x, int y) {
            if (x < xmin || x > xmax) {
                return false;
            }
            int xmid = (xmin + xmax) / 2;
            int diff = Math.abs(x - xmid);
            int yfrom = ymin + diff, yto = ymax - diff;
            return y >= yfrom && y <= yto;
        }
    }

    void solve() {
        O a = new O();
        O b = new O();
        for (int x = -100; x <= 100; x++) {
            for (int y = -100; y <= 100; y++) {
                if (a.inside(x, y) && b.inside2(x, y)) {
                    out.println("YES");
                    return;
                }
            }
        }
        out.println("NO");
    }

    void run() {
        try {
            in = new FastScanner(new File("A.in"));
            out = new PrintWriter(new File("A.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        new A().runIO();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by Arihant Jain on 6/16/2018.
 */
public class twoSquares {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String out[] = br.readLine().split(" ");
        int parallelX[] = new int[4];
        int parallelY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            parallelX[i/2] = Integer.parseInt(out[i]);
            parallelY[i/2] = Integer.parseInt(out[i+1]);
        }
        int x1 = Math.min(parallelX[0],parallelX[2]);
        int x2 = Math.max(parallelX[0], parallelX[2]);
        int y1 = Math.min(parallelY[0],parallelY[2]);
        int y2 = Math.max(parallelY[0], parallelY[2]);
        out = br.readLine().split(" ");
        int diagonalGivenX[] = new int[4];
        int diagonalGivenY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            diagonalGivenX[i/2] = Integer.parseInt(out[i]);
            diagonalGivenY[i/2] = Integer.parseInt(out[i+1]);
        }
        int xMin = 0;
        int xMax = 0;
        int yMin = 0;
        int yMax = 0;
        for (int i =1; i<4; i++) {
            if (diagonalGivenX[i]<diagonalGivenX[xMin])
                xMin = i;
            if (diagonalGivenX[i]>diagonalGivenX[xMax])
                xMax = i;
            if (diagonalGivenY[i]<diagonalGivenY[yMin])
                yMin = i;
            if (diagonalGivenY[i]>diagonalGivenY[yMax])
                yMax = i;
        }
        int[] diagonalX = new int[4];
        int[] diagonalY = new int[4];
        diagonalX[0] = diagonalGivenX[xMin];
        diagonalX[1] = diagonalGivenX[yMax];
        diagonalX[2] = diagonalGivenX[xMax];
        diagonalX[3] = diagonalGivenX[yMin];
        diagonalY[0] = diagonalGivenY[xMin];
        diagonalY[1] = diagonalGivenY[yMax];
        diagonalY[2] = diagonalGivenY[xMax];
        diagonalY[3] = diagonalGivenY[yMin];
        for (int i =0; i<4; i++) {
            if (diagonalX[i]>=x1 && diagonalX[i]<= x2 && diagonalY[i]>=y1 && diagonalY[i]<=y2) {
                System.out.println("YES");
                return;
            }
        }
        for (int i =0; i<4; i++) {
            int x = parallelX[i];
            int y = parallelY[i];
            if (y<=x+diagonalY[0]-diagonalX[0] && y<=-1*x+diagonalX[1]+diagonalY[1] && y>=x-diagonalX[2]+diagonalY[2] && y>=-1*x+diagonalX[3]+diagonalY[3]) {
                System.out.println("YES");
                return;
            }
        }
        int x = (x1+x2)/2;
        int y = (y1+y2)/2;
        if (y<=x+diagonalY[0]-diagonalX[0] && y<=-1*x+diagonalX[1]+diagonalY[1] && y>=x-diagonalX[2]+diagonalY[2] && y>=-1*x+diagonalX[3]+diagonalY[3]) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            Polygon p1 = new Polygon();
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            Rectangle r = p1.getBounds();
            Polygon p2 = new Polygon();
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            boolean inside = p2.intersects(r);
            boolean point = false;
            point |= intersPoint(p1, p2);
            point |= intersPoint(p2, p1);
            out.println((inside || point) ? "YES" : "NO");
        }

        boolean intersPoint(Polygon p1, Polygon p2) {
            for (int i = 0; i < p1.npoints; i++) {
                int i2 = (i + 1) % p1.npoints;
                int dx = p1.xpoints[i] - p1.xpoints[i2];
                int dy = p1.ypoints[i] - p1.ypoints[i2];
                Double edge = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
                for (int j = 0; j < p2.npoints; j++) {
                    dx = p1.xpoints[i] - p2.xpoints[j];
                    dy = p1.ypoints[i] - p2.ypoints[j];
                    Double edge1 = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
                    dx = p2.xpoints[j] - p1.xpoints[i2];
                    dy = p2.ypoints[j] - p1.ypoints[i2];
                    Double edge2 = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
                    if (edge1 + edge2 == edge) return true;
                }
            }
            return false;
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.*;
import java.io.*;
public class B{
	static int N = 10000005;
	public static void main(String[] args) {
		MyScanner scan = new MyScanner();
		PrintWriter pw = new PrintWriter(System.out);
		double x1 = scan.nextDouble();
		double y1 = scan.nextDouble();
		double x2 = scan.nextDouble();
		double y2 = scan.nextDouble();
		double x3 = scan.nextDouble();
		double y3 = scan.nextDouble();
		double x4 = scan.nextDouble();
		double y4 = scan.nextDouble();
		double X1 = scan.nextDouble();
		double Y1 = scan.nextDouble();
		double X2 = scan.nextDouble();
		double Y2 = scan.nextDouble();
		double X3 = scan.nextDouble();
		double Y3 = scan.nextDouble();
		double X4 = scan.nextDouble();
		double Y4 = scan.nextDouble();
		double arr[] = new double[4];
		arr[0] = X1;
		arr[1] = X2;
		arr[2] = X3;
		arr[3] = X4;
		Arrays.sort(arr);
		X1 = arr[0];
		X2 = arr[1];
		X3 = arr[2];
		X4 = arr[3];
		arr[0] = Y1;
		arr[1] = Y2;
		arr[2] = Y3;
		arr[3] = Y4;
		Arrays.sort(arr);
		Y1 = arr[0];
		Y2 = arr[1];
		Y3 = arr[2];
		Y4 = arr[3];
		double tempx1 = x1;
		x1 = Math.min(x1,x3);
		x2 = Math.max(tempx1,x3);
		double tempy1 = y1;
		y1 = Math.min(y1,y3);
		y2 = Math.max(tempy1,y3);
		for(double i = -100;i<=100;i++)
		{
			for(double j = -100;j<=100;j++)
			{

				if(i<=x2 && i>=x1 && j >= y1 && j <= y2)
				{

					double eq1 = j - i - (Y2 - X1);
					double eq2 = j - i - (Y1 - X2);
					double eq3 = j + i - (X2 + Y1);
					double eq4 = j + i - (X4 + Y2);
					if(eq1*eq2 <= 0 && eq3*eq4 <=0)
					{
						System.out.println("yes");
						return;
					}
				}
			}
		}
		System.out.println("no");

		pw.close();
	}
}
class Pair implements Comparable<Pair>{
	long p,c;
/*	Pair(int x,int y)
	{
		p = x;c = y;
	}*/
	@Override
	public int compareTo(Pair o)
	{
		return (int)this.p - (int)o.p;
	}
}

//-------------------------------------------------------------------------------------------------------
class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    public int mod(long x) {
        // TODO Auto-generated method stub
        return (int) x % 1000000007;
    }

    public int mod(int x) {
        return x % 1000000007;
    }

    boolean hasNext() {
        if (st.hasMoreElements())
            return true;
        try {
            st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
            e.printStackTrace();
        }
        return st.hasMoreTokens();
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
}

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

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

	FastReader in = new FastReader();
	PrintWriter out = new PrintWriter(System.out);
	void run(){
		work();
		out.flush();
	}
	long mod=998244353;
	long gcd(long a,long b) {
		return b==0?a:gcd(b,a%b);
	}
	void work() {
		int[] A=new int[] {99999999,-1,99999999,-1};//x1,x2,y1,y2
		int[] B=new int[] {99999999,-1,-1,99999999};//l,u,r,d
		int[][] P1=new int[4][];
		int[][] P2=new int[4][];
		for(int i=0;i<4;i++) {
			int x=in.nextInt();
			int y=in.nextInt();
			P1[i]=new int[] {x,y};
			A[0]=Math.min(A[0], x);
			A[1]=Math.max(A[1], x);
			A[2]=Math.min(A[2], y);
			A[3]=Math.max(A[3], y);
		}
		for(int i=0;i<4;i++) {
			int x=in.nextInt();
			int y=in.nextInt();
			P2[i]=new int[] {x,y};
			B[0]=Math.min(B[0], x);
			B[1]=Math.max(B[1], y);
			B[2]=Math.max(B[2], x);
			B[3]=Math.min(B[3], y);
		}
		//不想交
		if(B[0]>A[1]||B[1]<A[2]||B[2]<A[0]||B[3]>A[3]) {
			out.println("NO");
			return;
		}
		//某点在正方形中
		if(check(A,P2[0])||check(A,P2[1])||check(A,P2[2])||check(A,P2[3])) {
			out.println("YES");
			return;
		}
		//某点在菱形中
		if(check3((A[0]+A[1])/2,(A[2]+A[3])/2,P2)) {
			out.println("YES");
			return;
		}
		//边相交
		if(check2(P1,P2[0],P2[1])||check2(P1,P2[0],P2[3])||check2(P1,P2[1],P2[2])||check2(P1,P2[2],P2[3])) {
			out.println("YES");
			return;
		}
		out.println("NO");
	}
	private boolean check3(int x,int y,int[][] A) {
		if(check4(x,y,A[0],A[1])!=check4(x,y,A[2],A[3])&&check4(x,y,A[0],A[3])!=check4(x,y,A[1],A[2])) {
			return true;
		}
		return false;
	}
	private boolean check4(int x, int y, int[] P1, int[] P2) {
		return P1[1]-(P1[0]-x)*(P1[1]-P2[1])/(P1[0]-P2[0])>y;
	}
	private boolean check2(int[][] P, int[] P1, int[] P2) {
		int[] count=new int[2];
		for(int i=0;i<4;i++) {
			int x=P[i][0];
			int y=P[i][1];
			int ny=P1[1]-(P1[0]-x)*(P1[1]-P2[1])/(P1[0]-P2[0]);
			if(ny==y)return true;
			if(ny>y)count[0]++;
			else {
				count[1]++;
			}
		}
		return count[0]>0&&count[1]>0;
	}
	private boolean check(int[] A, int[] P) {
		if(A[0]<=P[0]&&A[1]>=P[0]&&A[2]<=P[1]&&A[3]>=P[1]) {
			return true;
		}
		return false;
	}
}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

	public FastReader()
	{
		br=new BufferedReader(new InputStreamReader(System.in));
	}

	public String next()
	{
		if(st==null || !st.hasMoreElements())
		{
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	public int nextInt()
	{
		return Integer.parseInt(next());
	}

	public long nextLong()
	{
		return Long.parseLong(next());
	}
}

//package que_a;

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

public class utkarsh {

    InputStream is;
    PrintWriter out;

    long mod = (long) (1e9 + 7);
    boolean SHOW_TIME;

    class pair {
        long X, Y;
        pair (long x, long y) {
            X = x;  Y = y;
        }
    }

    long area(pair p, pair q, pair r) {
        return Math.abs(p.X * (q.Y - r.Y) + q.X * (r.Y - p.Y) + r.X * (p.Y - q.Y));
    }

    boolean play(pair[] a, pair p) {
        long A = area(a[0], a[1], a[2]) + area(a[0], a[3], a[2]);
        long B = area(a[0], a[1], p) + area(a[1], a[2], p) + area(a[2], a[3], p) + area(a[3], a[0], p);
        return A == B;
    }

    void solve() {
        //Enter code here utkarsh
        //SHOW_TIME = true;
        pair[] a = new pair[4];
        for(int i = 0; i < 4; i++) {
            a[i] = new pair(nl(), nl());
        }
        pair[] d = new pair[4];
        for(int i = 0; i < 4; i++) d[i] = new pair(nl(), nl());
        for(int i = 0; i < 4; i++) {
            if(play(a, d[i]) || play(d, a[i])) {
                out.println("YES"); return;
            }
        }
        out.println("NO");
    }

    //---------- I/O Template ----------

    public static void main(String[] args) { new utkarsh().run(); }
    void run() {
        is = System.in;
        out = new PrintWriter(System.out);
        long start = System.currentTimeMillis();
        solve();
        long end = System.currentTimeMillis();
        if(SHOW_TIME) out.println("\n" + (end - start) + " ms");
        out.flush();
    }

    byte input[] = new byte[1024];
    int len = 0, ptr = 0;

    int readByte() {
        if(ptr >= len) { ptr = 0;
            try { len = is.read(input); }
            catch(IOException e) { throw new InputMismatchException(); }
            if(len <= 0) { return -1; }
        } return input[ptr++];
    }
    boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); }
    int skip() {
        int b = readByte();
        while(b != -1 && isSpaceChar(b)) { b = readByte(); }
        return b;
    }

    char nc() { return (char)skip(); }
    String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    String nLine() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while( !(isSpaceChar(b) && b != ' ') ) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    int ni() {
        int n = 0, b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        if(b == -1) { return -1; }  //no input
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }
    long nl() {
        long n = 0L;    int b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }

    double nd() { return Double.parseDouble(ns()); }
    float nf() { return Float.parseFloat(ns()); }
    int[] na(int n) {
        int a[] = new int[n];
        for(int i = 0; i < n; i++) { a[i] = ni(); }
        return a;
    }
    char[] ns(int n) {
        char c[] = new char[n];
        int i, b = skip();
        for(i = 0; i < n; i++) {
            if(isSpaceChar(b)) { break; }
            c[i] = (char)b; b = readByte();
        } return i == n ? c : Arrays.copyOf(c,i);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskC solver = new TaskC();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskC {

    double cos = Math.cos(Math.toRadians(45));
    double sin = Math.sin(Math.toRadians(45));
    int[] x = new int[4];
    int[] y = new int[4];
    double[] xr = new double[4];
    double[] yr = new double[4];

    boolean insideFirst(int i, int j) {
      return i >= x[0] && i <= x[3] && j >= y[0] && j <= y[3];
    }

    boolean insideSecond(int i, int j) {
      double ii = i * cos - j * sin;
      double jj = i * cos + j * sin;
      return ii >= xr[0] && ii <= xr[3] && jj >= yr[0] && jj <= yr[3];
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      for (int i = 0; i < 4; i++) {
        x[i] = in.nextInt();
        y[i] = in.nextInt();
      }
      Arrays.sort(x);
      Arrays.sort(y);

      for (int i = 0, x, y; i < 4; i++) {
        x = in.nextInt();
        y = in.nextInt();
        xr[i] = x * cos - y * sin;
        yr[i] = y * cos + x * sin;
      }
      Arrays.sort(xr);
      Arrays.sort(yr);
      for (int i = -100; i <= 100; i++) {
        for (int j = -100; j <= 100; j++) {
          if (insideFirst(i, j) && insideSecond(i, j)) {
            out.println("YES");
            return;
          }
        }
      }
      out.println("NO");
    }

  }

  static class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1 << 13];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == -1) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return -1;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public int nextInt() {
      int c;
      for (c = this.read(); isSpaceChar(c); c = this.read()) {
      }

      byte sgn = 1;
      if (c == 45) {
        sgn = -1;
        c = this.read();
      }

      int res = 0;

      while (c >= 48 && c <= 57) {
        res *= 10;
        res += c - 48;
        c = this.read();
        if (isSpaceChar(c)) {
          return res * sgn;
        }
      }

      throw new InputMismatchException();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;
    }

  }
}

import java.util.*;
public class TwoSquares {
    public static final double EPS = 1e-7;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] sq1X = new int[4];
        int[] sq1Y = new int[4];
        int[] sq2X = new int[4];
        int[] sq2Y = new int[4];
        for(int i = 0; i < 4; i++) {
            sq1X[i] = scanner.nextInt();
            sq1Y[i] = scanner.nextInt();
        }
        for(int i = 0; i < 4; i++) {
            sq2X[i] = scanner.nextInt();
            sq2Y[i] = scanner.nextInt();
        }
        Arrays.sort(sq1X);
        Arrays.sort(sq2Y);
        Arrays.sort(sq1Y);
        Arrays.sort(sq2X);
        if (sq1X[0] == sq2X[0] || sq1X[0] == sq2X[2] || sq1X[2] == sq2X[0] || sq1X[2] == sq2X[2] ||
                sq1Y[0] == sq2Y[0] || sq1Y[0] == sq2Y[2] || sq1Y[2] == sq2Y[0] || sq1Y[2] == sq2Y[2]) {
            System.out.println("Yes");
            System.exit(0);
        }
        if ((sq1X[0] > sq2X[0] && sq1X[0] < sq2X[2]) && (sq1Y[0]<sq2Y[2] || sq1Y[2] > sq2Y[0]) ||
                (sq1X[2] > sq2X[0] && sq1X[2] < sq2X[2]) && (sq1Y[0]<sq2Y[2] || sq1Y[2] > sq2Y[0]) ||
                (sq2X[0] > sq1X[0] && sq2X[0] < sq1X[2]) && (sq2Y[0]<sq1Y[2] || sq2Y[2] > sq1Y[0]) ||
                (sq2X[2] > sq1X[0] && sq2X[2] < sq1X[2]) && (sq2Y[0]<sq1Y[2] || sq2Y[2] > sq1Y[0])){
            System.out.println("Yes");

        }
        else {
            System.out.println("NO");
        }
    }
}

//package baobab;

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

public class C {

    public static void main(String[] args) {
        Solver solver = new Solver();
    }

    static class Solver {
        IO io;

        public Solver() {
            this.io = new IO();
            try {
                solve();
            } catch (RuntimeException e) {
                if (!e.getMessage().equals("Clean exit")) {
                    throw e;
                }
            } finally {
                io.close();
            }
        }

        /****************************** START READING HERE ********************************/

        void solve() {
            List<Point> a = new ArrayList<>(4);
            List<Point> b = new ArrayList<>(4);
            for (int i=0; i<4; i++) a.add(new Point(io.nextInt(), io.nextInt()));
            for (int i=0; i<4; i++) b.add(new Point(io.nextInt(), io.nextInt()));
            if (countPointsInside(a,b) >= 1) done("YES");
            if (countPointsInside(b,a) >= 1) done("YES");
            if (anyPointTouchesAnySegment(a,b)) done("YES");
            if (anyPointTouchesAnySegment(b,a)) done("YES");
            io.println("NO");
        }

        boolean anyPointTouchesAnySegment(List<Point> points, List<Point> segments) {
            for (Point p : points) {
                for (int i=0; i<4; i++) {
                    Point curr = segments.get(i);
                    Point next = segments.get((i+1)%4);
                    int x1 = curr.x;
                    int y1 = curr.y;
                    int x2 = next.x;
                    int y2 = next.y;
                    if (minDistFromPointToLineSegment(p.x, p.y, x1, y1, x2, y2) < 0.000000001) return true;
                }
            }
            return false;
        }

        int countPointsInside(List<Point> smaller, List<Point> larger) {
            int count = 0;
            for (Point insidePoint : smaller) {
                if (pointInsideRectangle(insidePoint, larger)) count++;
            }
            return count;
        }

        boolean closeToZero(double v) {
            return Math.abs(v) <= 0.0000000001;
        }

        boolean pointInsideRectangle(Point p, List<Point> r) {
            Point a = r.get(0);
            Point b = r.get(1);
            Point c = r.get(2);
            Point d = r.get(3);
            double apd = areaOfTriangle(a, p, d);
            double dpc = areaOfTriangle(d, p, c);
            double cpb = areaOfTriangle(c, p, b);
            double pba = areaOfTriangle(p, b, a);
            double sumOfAreas = apd + dpc + cpb + pba;
            if (closeToZero(sumOfAreas - areaOfRectangle(r))) {
                if (closeToZero(apd) || closeToZero(dpc) || closeToZero(cpb) || closeToZero(pba)) {
                    return false;
                }
                return true;
            }
            return false;
        }

        boolean arePointsOnSameLine(double x1, double y1, double x2, double y2, double x3, double y3) {
            Double areaTimes2 = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
            return (closeToZero(areaTimes2));
        }

        double minDistFromPointToLineSegment(double point_x, double point_y, double x1, double y1, double x2, double y2) {
            return Math.sqrt(distToSegmentSquared(point_x, point_y, x1, y1, x2, y2));
        }

        double distToSegmentSquared(double point_x, double point_y, double x1, double y1, double x2, double y2) {
            double l2 = dist2(x1,y1,x2,y2);
            if (l2 == 0) return dist2(point_x, point_y, x1, y1);
            double t = ((point_x - x1) * (x2 - x1) + (point_y - y1) * (y2 - y1)) / l2;
            if (t < 0) return dist2(point_x, point_y, x1, y1);
            if (t > 1) return dist2(point_x, point_y, x2, y2);

            double com_x = x1 + t * (x2 - x1);
            double com_y = y1 + t * (y2 - y1);
            return dist2(point_x, point_y, com_x, com_y);
        }

        double dist2(double x1, double y1, double x2, double y2) {
            return Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2);
        }

        double areaOfTriangle(Point a, Point b, Point c) {
            return 0.5 * Math.abs((a.x-c.x)*(b.y-a.y)-(a.x-b.x)*(c.y-a.y));
        }

        double areaOfRectangle(List<Point> sq) {
            double side1xDiff = sq.get(0).x - sq.get(1).x;
            double side1yDiff = sq.get(0).y - sq.get(1).y;
            double side2xDiff = sq.get(1).x - sq.get(2).x;
            double side2yDiff = sq.get(1).y - sq.get(2).y;
            double side1 = Math.sqrt(side1xDiff * side1xDiff + side1yDiff * side1yDiff);
            double side2 = Math.sqrt(side2xDiff * side2xDiff + side2yDiff * side2yDiff);
            return side1 * side2;
        }

        /************************** UTILITY CODE BELOW THIS LINE **************************/

        long MOD = (long)1e9 + 7;

        List<Integer>[] toGraph(IO io, int n) {
            List<Integer>[] g = new ArrayList[n+1];
            for (int i=1; i<=n; i++) g[i] = new ArrayList<>();
            for (int i=1; i<=n-1; i++) {
                int a = io.nextInt();
                int b = io.nextInt();
                g[a].add(b);
                g[b].add(a);
            }
            return g;
        }

        class Graph {
            HashMap<Long, List<Long>> edges;

            public Graph() {
                edges = new HashMap<>();
            }

            List<Long> getSetNeighbors(Long node) {
                List<Long> neighbors = edges.get(node);
                if (neighbors == null) {
                    neighbors = new ArrayList<>();
                    edges.put(node, neighbors);
                }
                return neighbors;
            }

            void addBiEdge(Long a, Long b) {
                addEdge(a, b);
                addEdge(b, a);
            }

            void addEdge(Long from, Long to) {
                getSetNeighbors(to); // make sure all have initialized lists
                List<Long> neighbors = getSetNeighbors(from);
                neighbors.add(to);
            }

            // topoSort variables
            int UNTOUCHED = 0;
            int FINISHED = 2;
            int INPROGRESS = 1;
            HashMap<Long, Integer> vis;
            List<Long> topoAns;
            List<Long> failDueToCycle = new ArrayList<Long>() {{ add(-1L); }};

            List<Long> topoSort() {
                topoAns = new ArrayList<>();
                vis = new HashMap<>();
                for (Long a : edges.keySet()) {
                    if (!topoDFS(a)) return failDueToCycle;
                }
                Collections.reverse(topoAns);
                return topoAns;
            }

            boolean topoDFS(long curr) {
                Integer status = vis.get(curr);
                if (status == null) status = UNTOUCHED;
                if (status == FINISHED) return true;
                if (status == INPROGRESS) {
                    return false;
                }
                vis.put(curr, INPROGRESS);
                for (long next : edges.get(curr)) {
                    if (!topoDFS(next)) return false;
                }
                vis.put(curr, FINISHED);
                topoAns.add(curr);
                return true;
            }

        }

        class Point {
            int y;
            int x;

            public Point(int y, int x) {
                this.y = y;
                this.x = x;
            }
        }

        class IDval implements Comparable<IDval> {
            int id;
            long val;

            public IDval(int id, long val) {
                this.val = val;
                this.id = id;
            }

            @Override
            public int compareTo(IDval o) {
                if (this.val < o.val) return -1;
                if (this.val > o.val) return 1;
                return this.id - o.id;
            }
        }

        long pow(long base, int exp) {
            if (exp == 0) return 1L;
            long x = pow(base, exp/2);
            long ans = x * x;
            if (exp % 2 != 0) ans *= base;
            return ans;
        }

        long gcd(long... v) {
            /** Chained calls to Euclidean algorithm. */
            if (v.length == 1) return v[0];
            long ans = gcd(v[1], v[0]);
            for (int i=2; i<v.length; i++) {
                ans = gcd(ans, v[i]);
            }
            return ans;
        }

        long gcd(long a, long b) {
            /** Euclidean algorithm. */
            if (b == 0) return a;
            return gcd(b, a%b);
        }

        int[] generatePrimesUpTo(int last) {
            /* Sieve of Eratosthenes. Practically O(n). Values of 0 indicate primes. */
            int[] div = new int[last+1];
            for (int x=2; x<=last; x++) {
                if (div[x] > 0) continue;
                for (int u=2*x; u<=last; u+=x) {
                    div[u] = x;
                }
            }
            return div;
        }

        long lcm(long a, long b) {
            /** Least common multiple */
            return a * b / gcd(a,b);
        }

        private class ElementCounter {
            private HashMap<Long, Integer> elements;

            public ElementCounter() {
                elements = new HashMap<>();
            }

            public void add(long element) {
                int count = 1;
                Integer prev = elements.get(element);
                if (prev != null) count += prev;
                elements.put(element, count);
            }

            public void remove(long element) {
                int count = elements.remove(element);
                count--;
                if (count > 0) elements.put(element, count);
            }

            public int get(long element) {
                Integer val = elements.get(element);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class StringCounter {
            HashMap<String, Integer> elements;

            public StringCounter() {
                elements = new HashMap<>();
            }

            public void add(String identifier) {
                int count = 1;
                Integer prev = elements.get(identifier);
                if (prev != null) count += prev;
                elements.put(identifier, count);
            }

            public void remove(String identifier) {
                int count = elements.remove(identifier);
                count--;
                if (count > 0) elements.put(identifier, count);
            }

            public long get(String identifier) {
                Integer val = elements.get(identifier);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class DisjointSet {
            /** Union Find / Disjoint Set data structure. */
            int[] size;
            int[] parent;
            int componentCount;

            public DisjointSet(int n) {
                componentCount = n;
                size = new int[n];
                parent = new int[n];
                for (int i=0; i<n; i++) parent[i] = i;
                for (int i=0; i<n; i++) size[i] = 1;
            }

            public void join(int a, int b) {
                /* Find roots */
                int rootA = parent[a];
                int rootB = parent[b];
                while (rootA != parent[rootA]) rootA = parent[rootA];
                while (rootB != parent[rootB]) rootB = parent[rootB];

                if (rootA == rootB) {
                    /* Already in the same set */
                    return;
                }

                /* Merge smaller set into larger set. */
                if (size[rootA] > size[rootB]) {
                    size[rootA] += size[rootB];
                    parent[rootB] = rootA;
                } else {
                    size[rootB] += size[rootA];
                    parent[rootA] = rootB;
                }
                componentCount--;
            }

        }

        class LCAFinder {

            /* O(n log n) Initialize: new LCAFinder(graph)
             * O(log n) Queries: find(a,b) returns lowest common ancestor for nodes a and b */

            int[] nodes;
            int[] depths;
            int[] entries;
            int pointer;
            FenwickMin fenwick;

            public LCAFinder(List<Integer>[] graph) {
                this.nodes = new int[(int)10e6];
                this.depths = new int[(int)10e6];
                this.entries = new int[graph.length];
                this.pointer = 1;
                boolean[] visited = new boolean[graph.length+1];
                dfs(1, 0, graph, visited);
                fenwick = new FenwickMin(pointer-1);
                for (int i=1; i<pointer; i++) {
                    fenwick.set(i, depths[i] * 1000000L + i);
                }
            }

            private void dfs(int node, int depth, List<Integer>[] graph, boolean[] visited) {
                visited[node] = true;
                entries[node] = pointer;
                nodes[pointer] = node;
                depths[pointer] = depth;
                pointer++;
                for (int neighbor : graph[node]) {
                    if (visited[neighbor]) continue;
                    dfs(neighbor, depth+1, graph, visited);
                    nodes[pointer] = node;
                    depths[pointer] = depth;
                    pointer++;
                }
            }

            public int find(int a, int b) {
                int left = entries[a];
                int right = entries[b];
                if (left > right) {
                    int temp = left;
                    left = right;
                    right = temp;
                }
                long mixedBag = fenwick.getMin(left, right);
                int index = (int) (mixedBag % 1000000L);
                return nodes[index];
            }
        }

        class FenwickMin {
            long n;
            long[] original;
            long[] bottomUp;
            long[] topDown;

            public FenwickMin(int n) {
                this.n = n;
                original = new long[n+2];
                bottomUp = new long[n+2];
                topDown = new long[n+2];
            }

            public void set(int modifiedNode, long value) {
                long replaced = original[modifiedNode];
                original[modifiedNode] = value;
                // Update left tree
                int i = modifiedNode;
                long v = value;
                while (i <= n) {
                    if (v > bottomUp[i]) {
                        if (replaced == bottomUp[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i-x;
                                v = Math.min(v, bottomUp[child]);
                            }
                        } else break;
                    }
                    if (v == bottomUp[i]) break;
                    bottomUp[i] = v;
                    i += (i&-i);
                }
                // Update right tree
                i = modifiedNode;
                v = value;
                while (i > 0) {
                    if (v > topDown[i]) {
                        if (replaced == topDown[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i+x;
                                if (child > n+1) break;
                                v = Math.min(v, topDown[child]);
                            }
                        } else break;
                    }
                    if (v == topDown[i]) break;
                    topDown[i] = v;
                    i -= (i&-i);
                }
            }

            public long getMin(int a, int b) {
                long min = original[a];
                int prev = a;
                int curr = prev + (prev&-prev); // parent right hand side
                while (curr <= b) {
                    min = Math.min(min, topDown[prev]); // value from the other tree
                    prev = curr;
                    curr = prev + (prev&-prev);;
                }
                min = Math.min(min, original[prev]);
                prev = b;
                curr = prev - (prev&-prev); // parent left hand side
                while (curr >= a) {
                    min = Math.min(min,bottomUp[prev]); // value from the other tree
                    prev = curr;
                    curr = prev - (prev&-prev);
                }
                return min;
            }

        }

        class FenwickSum {
            public long[] d;

            public FenwickSum(int n) {
                d=new long[n+1];
            }

            /** a[0] must be unused. */
            public FenwickSum(long[] a) {
                d=new long[a.length];
                for (int i=1; i<a.length; i++) {
                    modify(i, a[i]);
                }
            }

            /** Do not modify i=0. */
            void modify(int i, long v) {
                while (i<d.length) {
                    d[i] += v;
                    // Move to next uplink on the RIGHT side of i
                    i += (i&-i);
                }
            }

            /** Returns sum from a to b, *BOTH* inclusive. */
            long getSum(int a, int b) {
                return getSum(b) - getSum(a-1);
            }

            private long getSum(int i) {
                long sum = 0;
                while (i>0) {
                    sum += d[i];
                    // Move to next uplink on the LEFT side of i
                    i -= (i&-i);
                }
                return sum;
            }
        }

        class SegmentTree {
            /** Query sums with log(n) modifyRange */
            int N;
            long[] p;

            public SegmentTree(int n) {
                /* TODO: Test that this works. */
                for (N=2; N<n; N++) N *= 2;
                p = new long[2*N];
            }

            public void modifyRange(int a, int b, long change) {
                muuta(a, change);
                muuta(b+1, -change);
            }

            void muuta(int k, long muutos) {
                k += N;
                p[k] += muutos;
                for (k /= 2; k >= 1; k /= 2) {
                    p[k] = p[2*k] + p[2*k+1];
                }
            }

            public long get(int k) {
                int a = N;
                int b = k+N;
                long s = 0;
                while (a <= b) {
                    if (a%2 == 1) s += p[a++];
                    if (b%2 == 0) s += p[b--];
                    a /= 2;
                    b /= 2;
                }
                return s;
            }

        }

        class Zalgo {

            public int pisinEsiintyma(String haku, String kohde) {
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                int max = 0;
                for (int i=haku.length(); i<z.length; i++) {
                    max = Math.max(max, z[i]);
                }
                return max;
            }

            public int[] toZarray(char[] s) {
                int n = s.length;
                int[] z = new int[n];
                int a = 0, b = 0;
                for (int i = 1; i < n; i++) {
                    if (i > b) {
                        for (int j = i; j < n && s[j - i] == s[j]; j++)  z[i]++;
                    }
                    else {
                        z[i] = z[i - a];
                        if (i + z[i - a] > b) {
                            for (int j = b + 1; j < n && s[j - i] == s[j]; j++) z[i]++;
                            a = i;
                            b = i + z[i] - 1;
                        }
                    }
                }
                return z;
            }

            public List<Integer> getStartIndexesWhereWordIsFound(String haku, String kohde) {
                // this is alternative use case
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                List<Integer> indexes = new ArrayList<>();
                for (int i=haku.length(); i<z.length; i++) {
                    if (z[i] < haku.length()) continue;
                    indexes.add(i);
                }
                return indexes;
            }

        }

        class StringHasher {

            class HashedString {
                long[] hashes;
                long[] modifiers;

                public HashedString(long[] hashes, long[] modifiers) {
                    this.hashes = hashes;
                    this.modifiers = modifiers;
                }
            }

            long P;
            long M;

            public StringHasher() {
                initializePandM();
            }

            HashedString hashString(String s) {
                int n = s.length();
                long[] hashes = new long[n];
                long[] modifiers = new long[n];
                hashes[0] = s.charAt(0);
                modifiers[0] = 1;
                for (int i=1; i<n; i++) {
                    hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    modifiers[i] = (modifiers[i-1] * P) % M;
                }
                return new HashedString(hashes, modifiers);
            }

            /**
             * Indices are inclusive.
             */
            long getHash(HashedString hashedString, int startIndex, int endIndex) {
                long[] hashes = hashedString.hashes;
                long[] modifiers = hashedString.modifiers;
                long result = hashes[endIndex];
                if (startIndex > 0) result -= (hashes[startIndex-1] * modifiers[endIndex-startIndex+1]) % M;
                if (result < 0) result += M;
                return result;
            }

            // Less interesting methods below

            /**
             * Efficient for 2 input parameter strings in particular.
             */
            HashedString[] hashString(String first, String second) {
                HashedString[] array = new HashedString[2];
                int n = first.length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;

                long[] firstHashes = new long[n];
                firstHashes[0] = first.charAt(0);
                array[0] = new HashedString(firstHashes, modifiers);

                long[] secondHashes = new long[n];
                secondHashes[0] = second.charAt(0);
                array[1] = new HashedString(secondHashes, modifiers);

                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    firstHashes[i] = (firstHashes[i-1] * P + first.charAt(i)) % M;
                    secondHashes[i] = (secondHashes[i-1] * P + second.charAt(i)) % M;
                }
                return array;
            }

            /**
             * Efficient for 3+ strings
             * More efficient than multiple hashString calls IF strings are same length.
             */
            HashedString[] hashString(String... strings) {
                HashedString[] array = new HashedString[strings.length];
                int n = strings[0].length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;
                for (int j=0; j<strings.length; j++) {
                    // if all strings are not same length, defer work to another method
                    if (strings[j].length() != n) {
                        for (int i=0; i<n; i++) {
                            array[i] = hashString(strings[i]);
                        }
                        return array;
                    }

                    // otherwise initialize stuff
                    long[] hashes = new long[n];
                    hashes[0] = strings[j].charAt(0);
                    array[j] = new HashedString(hashes, modifiers);
                }
                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    for (int j=0; j<strings.length; j++) {
                        String s = strings[j];
                        long[] hashes = array[j].hashes;
                        hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    }
                }
                return array;
            }

            void initializePandM() {
                ArrayList<Long> modOptions = new ArrayList<>(20);
                modOptions.add(353873237L);
                modOptions.add(353875897L);
                modOptions.add(353878703L);
                modOptions.add(353882671L);
                modOptions.add(353885303L);
                modOptions.add(353888377L);
                modOptions.add(353893457L);
                P = modOptions.get(new Random().nextInt(modOptions.size()));

                modOptions.clear();
                modOptions.add(452940277L);
                modOptions.add(452947687L);
                modOptions.add(464478431L);
                modOptions.add(468098221L);
                modOptions.add(470374601L);
                modOptions.add(472879717L);
                modOptions.add(472881973L);
                M = modOptions.get(new Random().nextInt(modOptions.size()));

            }
        }

        private static class Prob {

            /** For heavy calculations on probabilities, this class
             *  provides more accuracy & efficiency than doubles.
             *  Math explained: https://en.wikipedia.org/wiki/Log_probability
             *  Quick start:
             *      - Instantiate probabilities, eg. Prob a = new Prob(0.75)
             *      - add(), multiply() return new objects, can perform on nulls & NaNs.
             *      - get() returns probability as a readable double */

            /** Logarithmized probability. Note: 0% represented by logP NaN. */
            private double logP;

            /** Construct instance with real probability. */
            public Prob(double real) {
                if (real > 0) this.logP = Math.log(real);
                else this.logP = Double.NaN;
            }

            /** Construct instance with already logarithmized value. */
            static boolean dontLogAgain = true;
            public Prob(double logP, boolean anyBooleanHereToChooseThisConstructor) {
                this.logP = logP;
            }

            /** Returns real probability as a double. */
            public double get() {
                return Math.exp(logP);
            }

            @Override
            public String toString() {
                return ""+get();
            }

            /***************** STATIC METHODS BELOW ********************/

            /** Note: returns NaN only when a && b are both NaN/null. */
            public static Prob add(Prob a, Prob b) {
                if (nullOrNaN(a) && nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                if (nullOrNaN(a)) return copy(b);
                if (nullOrNaN(b)) return copy(a);

                double x = Math.max(a.logP, b.logP);
                double y = Math.min(a.logP, b.logP);
                double sum = x + Math.log(1 + Math.exp(y - x));
                return new Prob(sum, dontLogAgain);
            }

            /** Note: multiplying by null or NaN produces NaN (repping 0% real prob). */
            public static Prob multiply(Prob a, Prob b) {
                if (nullOrNaN(a) || nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                return new Prob(a.logP + b.logP, dontLogAgain);
            }

            /** Returns true if p is null or NaN. */
            private static boolean nullOrNaN(Prob p) {
                return (p == null || Double.isNaN(p.logP));
            }

            /** Returns a new instance with the same value as original. */
            private static Prob copy(Prob original) {
                return new Prob(original.logP, dontLogAgain);
            }
        }

        public class StronglyConnectedComponents {

            /** Kosaraju's algorithm */

            ArrayList<Integer>[] forw;
            ArrayList<Integer>[] bacw;

            /** Use: getCount(2, new int[] {1,2}, new int[] {2,1}) */
            public int getCount(int n, int[] mista, int[] minne) {
                forw = new ArrayList[n+1];
                bacw = new ArrayList[n+1];
                for (int i=1; i<=n; i++) {
                    forw[i] = new ArrayList<Integer>();
                    bacw[i] = new ArrayList<Integer>();
                }
                for (int i=0; i<mista.length; i++) {
                    int a = mista[i];
                    int b = minne[i];
                    forw[a].add(b);
                    bacw[b].add(a);
                }
                int count = 0;
                List<Integer> list = new ArrayList<Integer>();
                boolean[] visited = new boolean[n+1];
                for (int i=1; i<=n; i++) {
                    dfsForward(i, visited, list);
                }
                visited = new boolean[n+1];
                for (int i=n-1; i>=0; i--) {
                    int node = list.get(i);
                    if (visited[node]) continue;
                    count++;
                    dfsBackward(node, visited);
                }
                return count;
            }

            public void dfsForward(int i, boolean[] visited, List<Integer> list) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : forw[i]) {
                    dfsForward(neighbor, visited, list);
                }
                list.add(i);
            }

            public void dfsBackward(int i, boolean[] visited) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : bacw[i]) {
                    dfsBackward(neighbor, visited);
                }
            }
        }

        class DrawGrid {

            void draw(boolean[][] d) {
                System.out.print("  ");
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(" " + x + " ");
                }
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print((d[y][x] ? "[x]" : "[ ]"));
                    }
                    System.out.println("");
                }
            }

            void draw(int[][] d) {
                int max = 1;
                for (int y=0; y<d.length; y++) {
                    for (int x=0; x<d[0].length; x++) {
                        max = Math.max(max, ("" + d[y][x]).length());
                    }
                }
                System.out.print("  ");
                String format = "%" + (max+2) + "s";
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(String.format(format, x) + " ");
                }
                format = "%" + (max) + "s";
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print(" [" + String.format(format, (d[y][x])) + "]");
                    }
                    System.out.println("");
                }
            }

        }

        class BaseConverter {

            /* Palauttaa luvun esityksen kannassa base */
            public String convert(Long number, int base) {
                return Long.toString(number, base);
            }

            /* Palauttaa luvun esityksen kannassa baseTo, kun annetaan luku Stringinä kannassa baseFrom */
            public String convert(String number, int baseFrom, int baseTo) {
                return Long.toString(Long.parseLong(number, baseFrom), baseTo);
            }

            /* Tulkitsee kannassa base esitetyn luvun longiksi (kannassa 10) */
            public long longify(String number, int baseFrom) {
                return Long.parseLong(number, baseFrom);
            }
        }

        class Binary implements Comparable<Binary> {

            /**
             * Use example: Binary b = new Binary(Long.toBinaryString(53249834L));
             *
             * When manipulating small binary strings, instantiate new Binary(string)
             * When just reading large binary strings, instantiate new Binary(string,true)
             * get(int i) returns a character '1' or '0', not an int.
             */

            private boolean[] d;
            private int first; // Starting from left, the first (most remarkable) '1'
            public int length;

            public Binary(String binaryString) {
                this(binaryString, false);
            }
            public Binary(String binaryString, boolean initWithMinArraySize) {
                length = binaryString.length();
                int size = Math.max(2*length, 1);
                first = length/4;
                if (initWithMinArraySize) {
                    first = 0;
                    size = Math.max(length, 1);
                }
                d = new boolean[size];
                for (int i=0; i<length; i++) {
                    if (binaryString.charAt(i) == '1') d[i+first] = true;
                }
            }

            public void addFirst(char c) {
                if (first-1 < 0) doubleArraySize();
                first--;
                d[first] = (c == '1' ? true : false);
                length++;
            }

            public void addLast(char c) {
                if (first+length >= d.length) doubleArraySize();
                d[first+length] = (c == '1' ? true : false);
                length++;
            }

            private void doubleArraySize() {
                boolean[] bigArray = new boolean[(d.length+1) * 2];
                int newFirst = bigArray.length / 4;
                for (int i=0; i<length; i++) {
                    bigArray[i + newFirst] = d[i + first];
                }
                first = newFirst;
                d = bigArray;
            }

            public boolean flip(int i) {
                boolean value = (this.d[first+i] ? false : true);
                this.d[first+i] = value;
                return value;
            }

            public void set(int i, char c) {
                boolean value = (c == '1' ? true : false);
                this.d[first+i] = value;
            }

            public char get(int i) {
                return (this.d[first+i] ? '1' : '0');
            }

            @Override
            public int compareTo(Binary o) {
                if (this.length != o.length) return this.length - o.length;
                int len = this.length;
                for (int i=0; i<len; i++) {
                    int diff = this.get(i) - o.get(i);
                    if (diff != 0) return diff;
                }
                return 0;
            }

            @Override
            public String toString() {
                StringBuilder sb = new StringBuilder();
                for (int i=0; i<length; i++) {
                    sb.append(d[i+first] ? '1' : '0');
                }
                return sb.toString();
            }

        }

        class BinomialCoefficients {
            /** Total number of K sized unique combinations from pool of size N (unordered)
             N! / ( K! (N - K)! )   */

            /** For simple queries where output fits in long. */
            public long biCo(long n, long k) {
                long r = 1;
                if (k > n) return 0;
                for (long d = 1; d <= k; d++) {
                    r *= n--;
                    r /= d;
                }
                return r;
            }

            /** For multiple queries with same n, different k. */
            public long[] precalcBinomialCoefficientsK(int n, int maxK) {
                long v[] = new long[maxK+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,maxK); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                    }
                }
                return v;
            }

            /** When output needs % MOD. */
            public long[] precalcBinomialCoefficientsK(int n, int k, long M) {
                long v[] = new long[k+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,k); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                        v[j] %= M;
                    }
                }
                return v;
            }
        }

        class Trie {
            int N;
            int Z;
            int nextFreeId;
            int[][] pointers;
            boolean[] end;

            /** maxLenSum = maximum possible sum of length of words */
            public Trie(int maxLenSum, int alphabetSize) {
                this.N = maxLenSum;
                this.Z = alphabetSize;
                this.nextFreeId = 1;
                pointers = new int[N+1][alphabetSize];
                end = new boolean[N+1];
            }

            public void addWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) {
                        next = nextFreeId++;
                        pointers[curr][c] = next;
                    }
                    curr = next;
                }
                end[curr] = true;
            }

            public boolean hasWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) return false;
                    curr = next;
                }
                return end[curr];
            }

        }

        private class IO extends PrintWriter {
            private InputStreamReader r;
            private static final int BUFSIZE = 1 << 15;
            private char[] buf;
            private int bufc;
            private int bufi;
            private StringBuilder sb;

            public IO() {
                super(new BufferedOutputStream(System.out));
                r = new InputStreamReader(System.in);

                buf = new char[BUFSIZE];
                bufc = 0;
                bufi = 0;
                sb = new StringBuilder();
            }

            /** Print, flush, return nextInt. */
            private int queryInt(String s) {
                io.println(s);
                io.flush();
                return nextInt();
            }

            /** Print, flush, return nextLong. */
            private long queryLong(String s) {
                io.println(s);
                io.flush();
                return nextLong();
            }

            /** Print, flush, return next word. */
            private String queryNext(String s) {
                io.println(s);
                io.flush();
                return next();
            }

            private void fillBuf() throws IOException {
                bufi = 0;
                bufc = 0;
                while(bufc == 0) {
                    bufc = r.read(buf, 0, BUFSIZE);
                    if(bufc == -1) {
                        bufc = 0;
                        return;
                    }
                }
            }

            private boolean pumpBuf() throws IOException {
                if(bufi == bufc) {
                    fillBuf();
                }
                return bufc != 0;
            }

            private boolean isDelimiter(char c) {
                return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';
            }

            private void eatDelimiters() throws IOException {
                while(true) {
                    if(bufi == bufc) {
                        fillBuf();
                        if(bufc == 0) throw new RuntimeException("IO: Out of input.");
                    }

                    if(!isDelimiter(buf[bufi])) break;
                    ++bufi;
                }
            }

            public String next() {
                try {
                    sb.setLength(0);

                    eatDelimiters();
                    int start = bufi;

                    while(true) {
                        if(bufi == bufc) {
                            sb.append(buf, start, bufi - start);
                            fillBuf();
                            start = 0;
                            if(bufc == 0) break;
                        }

                        if(isDelimiter(buf[bufi])) break;
                        ++bufi;
                    }

                    sb.append(buf, start, bufi - start);

                    return sb.toString();
                } catch(IOException e) {
                    throw new RuntimeException("IO.next: Caught IOException.");
                }
            }

            public int nextInt() {
                try {
                    int ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextInt: Invalid int.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");
                            ret *= 10;
                            ret -= (int)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");
                        } else {
                            throw new RuntimeException("IO.nextInt: Invalid int.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextInt: Caught IOException.");
                }
            }

            public long nextLong() {
                try {
                    long ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextLong: Invalid long.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");
                            ret *= 10;
                            ret -= (long)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");
                        } else {
                            throw new RuntimeException("IO.nextLong: Invalid long.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextLong: Caught IOException.");
                }
            }

            public double nextDouble() {
                return Double.parseDouble(next());
            }

        }

        void print(Object output) {
            io.println(output);
        }

        void done(Object output) {
            print(output);
            done();
        }

        void done() {
            io.close();
            throw new RuntimeException("Clean exit");
        }

        long min(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        double min(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        int min(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        long max(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        double max(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        int max(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

    }

}

import java.util.Arrays;
import java.util.Scanner;

public class C {

	static class Point {
		int x;
		int y;

		public Point(int xx, int yy) {
			x = xx;
			y = yy;
		}
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Point[] a = new Point[4];
		for(int i = 0; i < 4; ++i) a[i] = new Point(in.nextInt(), in.nextInt());

		Point[] b = new Point[4];
		for(int i = 0; i < 4; ++i) b[i] = new Point(in.nextInt(), in.nextInt());
		in.close();

		if(check(a,b)) {
			System.out.println("YES");
		}
		else System.out.println("NO");

	}

	static boolean check(Point[] a, Point[] b) {

		for(int i = 0; i < 4; ++i) {
			for(int j = 0; j < 4; ++j) {
				if(intersect(a[i], a[(i+1)%4], b[j], b[(j+1)%4])) return true;
			}
		}

		for(int i = 0; i < 4; ++i) {
			if(isInside(a, b[i])) return true;
		}

		for(int i = 0; i < 4; ++i) {
			if(isInside(b, a[i])) return true;
		}
		return false;
	}

	static boolean isInside(Point[] polygon, Point p)
	{
	    // There must be at least 3 vertices in polygon[]
	    if (polygon.length < 3)  return false;

	    // Create a point for line segment from p to infinite
	    Point extreme = new Point(10000, p.y);

	    // Count intersections of the above line with sides of polygon
	    int count = 0, i = 0;
	    do
	    {
	        int next = (i+1)%polygon.length;

	        // Check if the line segment from 'p' to 'extreme' intersects
	        // with the line segment from 'polygon[i]' to 'polygon[next]'
	        if (intersect(polygon[i], polygon[next], p, extreme))
	        {
	            // If the point 'p' is colinear with line segment 'i-next',
	            // then check if it lies on segment. If it lies, return true,
	            // otherwise false
	            if (direction(polygon[i], p, polygon[next]) == 0)
	               return onSegment(polygon[i], p, polygon[next]);

	            count++;
	        }
	        i = next;
	    } while (i != 0);

	    // Return true if count is odd, false otherwise
	    return (count%2 == 1);
	}

	public static boolean intersect(Point p1, Point p2, Point p3, Point p4) {
		int d1 = direction(p3, p4, p1); // p3p4, p3p1
		int d2 = direction(p3, p4, p2);
		int d3 = direction(p1, p2, p3);
		int d4 = direction(p1, p2, p4);
		if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0)))
			return true;
		else if (d1 == 0 && onSegment(p3, p4, p1))
			return true;
		else if (d2 == 0 && onSegment(p3, p4, p2))
			return true;
		else if (d3 == 0 && onSegment(p1, p2, p3))
			return true;
		else if (d4 == 0 && onSegment(p1, p2, p4))
			return true;
		return false;
	}

	public static int direction(Point p1, Point p2, Point p3) {
		return (p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y);
	}

	public static boolean onSegment(Point p1, Point p2, Point p3) {
		return Math.min(p1.x, p2.x) <= p3.x && p3.x >= Math.max(p1.x, p2.x) && Math.min(p1.y, p2.y) <= p3.y
				&& p3.y >= Math.max(p1.y, p2.y);
	}

}

import java.io.BufferedReader;
import java.io.IOError;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer stk = new StringTokenizer(br.readLine());
        Line[][] p = new Line[2][4];
        int[][][] arr = new int[2][4][2];
        int maxX = -10000000;
        int minX = 10000000;
        int maxY = - 10000000;
        int minY = 10000000;
        for(int i=0;i<4;i++){
            int x = Integer.parseInt(stk.nextToken());
            int y = Integer.parseInt(stk.nextToken());
            arr[0][i][0] = x;
            arr[0][i][1] = y;
            maxX = Math.max(maxX,x);
            minX = Math.min(minX,x);
            maxY = Math.max(maxY,y);
            minY = Math.min(minY,y);
        }
        stk = new StringTokenizer(br.readLine());
        for(int i=0;i<4;i++){
            int x = Integer.parseInt(stk.nextToken());
            int y = Integer.parseInt(stk.nextToken());
            arr[1][i][0] = x;
            arr[1][i][1] = y;
        }
        for(int i=0;i<4;i++){
            p[0][i] = new Line(arr[0][i][0],arr[0][i][1],arr[0][(i+1)%4][0],arr[0][(i+1)%4][1]);
        }
        for(int i=0;i<4;i++){
            p[1][i] = new Line(arr[1][i][0],arr[1][i][1],arr[1][(i+1)%4][0],arr[1][(i+1)%4][1]);
        }
        for(int i=0;i<4;i++){
            Line l1 = p[0][i];
            if(l1.x1==l1.x2){
                //vertical
                for(int j=0;j<4;j++){
                    int a = get(p[1][j]);
                    int b = get2(a,p[1][j]);
                        int interSectPoint = a*l1.x1 +b;
                    if(interSectPoint<=Math.max(p[1][j].y1,p[1][j].y2)&&interSectPoint>=Math.min(p[1][j].y1,p[1][j].y2)
                            &&l1.x1>=Math.min(p[1][j].x1,p[1][j].x2) && l1.x1<= Math.max(p[1][j].x1,p[1][j].x2)
                            &&
                            interSectPoint<=Math.max(l1.y1,l1.y2)
                            &&
                            interSectPoint>=Math.min(l1.y1,l1.y2)){
                            System.out.println("YES");
                        //    System.out.println(l1.x1+" "+interSectPoint);
                            return; }
                }
            }
            else{
                for(int j=0;j<4;j++){
                    int a = get(p[1][j]);
                    int b = get2(a,p[1][j]);
                    int interSectPoint = a*(l1.y1-b);
                  //  System.out.println(interSectPoint+" "+l1.y1+" "+p[1][j].x1+" "+p[1][j].y1+" "+p[1][j].x2+" "+p[1][j].y2);
                    if(interSectPoint<=Math.max(p[1][j].x1,p[1][j].x2)
                            &&
                            interSectPoint>=Math.min(p[1][j].x1,p[1][j].x2)
                            &&
                            l1.y1>=Math.min(p[1][j].y1,p[1][j].y2)
                            &&
                            l1.y1<= Math.max(p[1][j].y1,p[1][j].y2)
                            &&
                            interSectPoint<=Math.max(l1.x1,l1.x2)
                            &&
                            interSectPoint>=Math.min(l1.x1,l1.x2)){
                      //  System.out.println(interSectPoint+" "+l1.y1);
                        System.out.println("YES");return; }
                }
            }
        }
        boolean flag = true;
        for(int i=0;i<4;i++){
            if(!(arr[1][i][0]>=minX&&arr[1][i][0]<=maxX&&arr[1][i][1]>=minY&&arr[1][i][1]<=maxY)){
                flag = false;
            }
        }
        if (flag) {
            System.out.println("YES"); return;
        }
        System.out.println("NO");
    }
    static int get(Line l){
        return (l.y1-l.y2)/(l.x1-l.x2);
    }
    static int get2(int a,Line l){
        return l.y1-(a*l.x1);
    }
    static class Line {
        int x1,y1,x2,y2;
        public Line(int x1,int y1,int x2,int y2){
            this.x1 = x1;
            this.x2 = x2;
            this.y1 = y1;
            this.y2 = y2;
        }
    }
}

import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class two_squares {

	public static void main(String[] args) throws Exception {
		new two_squares().run();
	}

	public void run() throws Exception {
		FastIO file = new FastIO();
		double x1 = file.nextInt();
		double y1 = file.nextInt();
		double x2 = file.nextInt();
		double y2 = file.nextInt();
		double x3 = file.nextInt();
		double y3 = file.nextInt();
		double x4 = file.nextInt();
		double y4 = file.nextInt();
		double minx1, maxx1, miny1, maxy1;
		minx1 = Math.min(x1, Math.min(x2, Math.min(x3, x4)));
		maxx1 = Math.max(x1, Math.max(x2, Math.max(x3, x4)));
		miny1 = Math.min(y1, Math.min(y2, Math.min(y3, y4)));
		maxy1 = Math.max(y1, Math.max(y2, Math.max(y3, y4)));
		double x5 = file.nextInt();
		double y5 = file.nextInt();
		double x6 = file.nextInt();
		double y6 = file.nextInt();
		double x7 = file.nextInt();
		double y7 = file.nextInt();
		double x8 = file.nextInt();
		double y8 = file.nextInt();
		double minx2, maxx2, miny2, maxy2;
		minx2 = Math.min(x5, Math.min(x6, Math.min(x7, x8)));
		maxx2 = Math.max(x5, Math.max(x6, Math.max(x7, x8)));
		miny2 = Math.min(y5, Math.min(y6, Math.min(y7, y8)));
		maxy2 = Math.max(y5, Math.max(y6, Math.max(y7, y8)));
		Point _1, _2, _3, _4, _5, _6, _7, _8;
		_1 = new Point(x1, y1);
		_2 = new Point(x2, y2);
		_3 = new Point(x3, y3);
		_4 = new Point(x4, y4);
		_5 = new Point(x5, y5);
		_6 = new Point(x6, y6);
		_7 = new Point(x7, y7);
		_8 = new Point(x8, y8);
		Point[] a = {_1, _2, _3, _4};
		Point[] b = {_5, _6, _7, _8};
		boolean works = false;
		for (Point p : b) {
			if (p.x >= minx1 && p.x <= maxx1 && p.y >= miny1 && p.y <= maxy1) {
				works = true;
			}
		}
		for (Point p : a) {
			if (p.x >= minx2 && p.x <= maxx2) {
				double dist = Math.abs((minx2 + maxx2) / 2 - p.x);
				if (p.x >= minx2 + dist * ((miny2 + maxy2) / 2 - miny2) / ((minx2 + maxx2) / 2 - minx2)) {
					if (p.x <= maxx2 - dist * ((miny2 + maxy2) / 2 - miny2) / ((minx2 + maxx2) / 2 - minx2)) {
						works = true;
					}
				}
			}
		}
		System.out.println(works ? "YES" : "NO");
	}
	public static class Point {
		double x, y;
		public Point(double a, double b) {
			x = a;
			y = b;
		}
	}
	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;

		public FastIO() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, p / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, p / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd(y % x, x);
	}

	public static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        new Solver().run(1);
    }
}

class Solver {

    private BufferedReader reader = null;
    private StringTokenizer st = null;

    private Point[][] points = new Point[4][4];
    private boolean intersectionFound = false;

    public void run(int inputType) throws Exception {
        if (inputType == 0)
            reader = new BufferedReader(new FileReader("input.txt"));
        else
            reader = new BufferedReader(new InputStreamReader(System.in));

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < 4; ++i) {
            points[0][i] = new Point(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < 4; ++i) {
            points[1][i] = new Point(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        for (int i = 0; i < 2; ++i) {
            for (int j = 0; j < 4; ++j) {

                int nextSq = (i + 1) % 2;
                int res1 = crossProductSign(points[nextSq][0], points[nextSq][1], points[i][j]);
                int res2 = crossProductSign(points[nextSq][1], points[nextSq][2], points[i][j]);
                int res3 = crossProductSign(points[nextSq][2], points[nextSq][3], points[i][j]);
                int res4 = crossProductSign(points[nextSq][3], points[nextSq][0], points[i][j]);

                if ((res1 == 0 && inside(points[nextSq][0], points[nextSq][1], points[i][j]))
                        || (res2 == 0 && inside(points[nextSq][1], points[nextSq][2], points[i][j]))
                        || (res3 == 0 && inside(points[nextSq][2], points[nextSq][3], points[i][j]))
                        || (res4 == 0 && inside(points[nextSq][3], points[nextSq][0], points[i][j]))) {

                    intersectionFound = true;
                    break;
                }

                if (res1 == res2 && res2 == res3 && res3 == res4) {
                    intersectionFound = true;
                    break;
                }
            }

            if (intersectionFound)
                break;
        }

        if (intersectionFound)
            System.out.println("YES");
        else
            System.out.println("NO");

        reader.close();
    }

    boolean inside(Point p1, Point p2, Point p3) {
        int xhigh = Math.max(p2.x, p1.x);
        int xlow = Math.min(p2.x, p1.x);
        int yhigh = Math.max(p2.y, p1.y);
        int ylow = Math.max(p2.y, p1.y);

        return p3.x >= xlow && p3.x <= xhigh && p3.y >= ylow && p3.y <= yhigh;
    }

    int crossProductSign(Point p1, Point p2, Point p3) {
        int res = (p2.x - p1.x) * (p3.y - p1.y) - (p2.y - p1.y) * (p3.x - p1.x);

        if (res < 0)
            return -1;

        if (res > 0)
            return 1;

        return 0;
    }

    class Point {
        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}

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

public class check {
    static boolean DEBUG_FLAG = false;
    int INF = (int)1e9;
    long MOD = 1000000007;

    static void debug(String s) {
        if(DEBUG_FLAG) {
            System.out.print(s);
        }
    }

    boolean go(int x1, int x2, int y1, int y2, int x, int y) {
        if(x1<=x && x<=x2) {
            if(y1<=y && y<=y2) {
                return true;
            }
        }
        return false;
    }

    boolean cross(int[][] a, int[][] b) {
        double x = 0;
        for(int i=0; i<4; i++) {
            for(int j=0; j<4; j++) {
                if(i!=j && a[i][0]==a[j][0]) {
                    x = Math.abs(a[i][1]-a[j][1]);
                }
            }
        }
        x *= x;
        x /= 2;
        for(int i=0; i<4; i++) {
            double y = ar(b[i][0], b[i][1], a[0][0], a[0][1], a[3][0], a[3][1]);
            y += ar(b[i][0], b[i][1], a[2][0], a[2][1], a[3][0], a[3][1]);
            y += ar(b[i][0], b[i][1], a[2][0], a[2][1], a[1][0], a[1][1]);
            y += ar(b[i][0], b[i][1], a[0][0], a[0][1], a[1][0], a[1][1]);
            if(y==x) return true;
        }
        return false;
    }

    double ar(int x1, int y1, int x2, int y2, int x3, int y3) {
        double a = x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2);
        if(a<0) a = -a;
        a/=2;
        return a;
    }

    void solve(InputReader in, PrintWriter out) throws IOException {
        int x1 = INF, x2 = -INF;
        int y1 = INF, y2 = -INF;
        int[][] b = new int[4][2];
        for(int i=0; i<4; i++) {
            int x = in.nextInt();
            int y = in.nextInt();
            x1 = Math.min(x, x1);
            x2 = Math.max(x, x2);
            y1 = Math.min(y, y1);
            y2 = Math.max(y, y2);
            b[i][0] = x;
            b[i][1] = y;
        }
        boolean f = false;
        int[][] a = new int[4][2];
        for(int i=0; i<4; i++) {
            a[i][0] = in.nextInt();
            a[i][1] = in.nextInt();
            f = f | go(x1, x2, y1, y2, a[i][0], a[i][1]);
        }
        f = f | cross(a, b);
        if(f) {
            out.println("YES");
        } else {
            out.println("NO");
        }
    }

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new check().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }

    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            Polygon p1 = new Polygon();
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            Rectangle r = p1.getBounds();
            Polygon p2 = new Polygon();
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            boolean inside = p2.intersects(r);
            boolean point1 = false;
            for (int i = 0; i < p1.npoints; i++) {
                point1 |= p2.contains(p1.xpoints[i], p1.ypoints[i]);
            }
            boolean point2 = false;
            for (int i = 0; i < p2.npoints; i++) {
                point2 |= p1.contains(p2.xpoints[i], p2.ypoints[i]);
            }
            out.println((inside || point1 || point2) ? "YES" : "NO");
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Main
{
    static long mod=1000000007;
    public static void main(String[] args) throws Exception
    {
    	FastReader in=new FastReader();
    	PrintWriter pw=new PrintWriter(System.out);
    	int axmax=-101,axmin=101,aymax=-101,aymin=101;
    	int bxmax=-101,bxmin=101,bymax=-101,bymin=101;
    	int[][] c=new int[8][2];
    	for(int i=0;i<8;i++)
    	{
    		c[i][0]=in.nextInt();
    		c[i][1]=in.nextInt();
    		if(i>3)
    		{
    			c[i][0]=c[i][0]+c[i][1];
    			c[i][1]=c[i][1]-c[i][0];
    		}
    	}
    	for(int i=0;i<4;i++)
    	{

			axmin=Math.min(axmin,c[i][0]);
			axmax=Math.max(axmax,c[i][0]);
			aymin=Math.min(aymin,c[i][1]);
			aymax=Math.max(aymax,c[i][1]);
    	}
    	for(int i=4;i<8;i++)
    	{
			bxmin=Math.min(bxmin,c[i][0]);
			bxmax=Math.max(bxmax,c[i][0]);
			bymin=Math.min(bymin,c[i][1]);
			bymax=Math.max(bymax,c[i][1]);
    	}
    	String ans="NO";
    	for(int x=axmin;x<=axmax;x++)
    	{
    		for(int y=aymin;y<=aymax;y++)
    		{
    			if(bxmin<=x+y && x+y<=bxmax && bymin<=y-x && y-x<=bymax)
    				ans="YES";
    		}
    	}
    	pw.print(ans);
    	pw.flush();
    }

    public static long inverse(long a)
    {
    	long r=1,p=mod-2;
    	while(p>0)
    	{
    		if(p%2==1)
    		{
    			r*=a;
    			r%=mod;
    		}
    		p>>=1;
    		a=(a*a)%mod;
    	}

    	return r;
    }

}

class pair<A,B>
{
    A f;
    B s;

    public pair(A a,B b)
    {
        f=a;
        s=b;
    }
}

class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        br=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next() throws IOException
    {
        if(st==null || !st.hasMoreElements())
        {
            st=new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

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

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

//package baobab;

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

public class C {

    public static void main(String[] args) {
        Solver solver = new Solver();
    }

    static class Solver {
        IO io;

        public Solver() {
            this.io = new IO();
            try {
                solve();
            } catch (RuntimeException e) {
                if (!e.getMessage().equals("Clean exit")) {
                    throw e;
                }
            } finally {
                io.close();
            }
        }

        /****************************** START READING HERE ********************************/

        void solve() {
            List<Point> a = new ArrayList<>(4);
            List<Point> b = new ArrayList<>(4);
            for (int i=0; i<4; i++) a.add(new Point(io.nextInt(), io.nextInt()));
            for (int i=0; i<4; i++) b.add(new Point(io.nextInt(), io.nextInt()));
            int countAB = countPointsInside(a,b);
            int countBA = countPointsInside(b,a);
            if (countAB >= 1) done("YES");
            if (countBA >= 1) done("YES");
            io.println("NO");
        }

        int countPointsInside(List<Point> smaller, List<Point> larger) {
            int count = 0;
            for (Point insidePoint : smaller) {
                if (pointInsideSq(insidePoint, larger)) count++;
            }
            return count;
        }

        boolean pointInsideSq(Point p, List<Point> sq) {
            double zero = 0.0000000001;
            Point a = sq.get(0);
            Point b = sq.get(1);
            Point c = sq.get(2);
            Point d = sq.get(3);
            double apd = areaOfTriangle(a, p, d);
            double dpc = areaOfTriangle(d, p, c);
            double cpb = areaOfTriangle(c, p, b);
            double pba = areaOfTriangle(p, b, a);
            double sumOfAreas = apd + dpc + cpb + pba;
            if (sumOfAreas > areaOfSq(sq)) {
                return false;
            } else if (Math.abs(sumOfAreas - areaOfSq(sq)) <= zero) {
                if (apd <= zero || dpc <= zero || cpb <= zero || pba <= zero) {
                    return false;
                }
                return true;
            }
            return false;
        }

        double areaOfTriangle(Point a, Point b, Point c) {
            return 0.5 * Math.abs((a.x-c.x)*(b.y-a.y)-(a.x-b.x)*(c.y-a.y));
        }

        double areaOfSq(List<Point> sq) {
            int minY = sq.get(0).y;
            int maxY = sq.get(0).x;
            for (Point p : sq) {
                minY = Math.min(minY, p.y);
                maxY = Math.max(maxY, p.y);
            }
            if (sq.get(1).y != sq.get(0).y && sq.get(1).x != sq.get(0).x) {
                // 45 deg
                int halkaisija = maxY - minY;
                return 0.5 * halkaisija * halkaisija;
            } else {
                int side = maxY - minY;
                return 1.0 * side * side;
            }
        }

        /************************** UTILITY CODE BELOW THIS LINE **************************/

        long MOD = (long)1e9 + 7;

        List<Integer>[] toGraph(IO io, int n) {
            List<Integer>[] g = new ArrayList[n+1];
            for (int i=1; i<=n; i++) g[i] = new ArrayList<>();
            for (int i=1; i<=n-1; i++) {
                int a = io.nextInt();
                int b = io.nextInt();
                g[a].add(b);
                g[b].add(a);
            }
            return g;
        }

        class Graph {
            HashMap<Long, List<Long>> edges;

            public Graph() {
                edges = new HashMap<>();
            }

            List<Long> getSetNeighbors(Long node) {
                List<Long> neighbors = edges.get(node);
                if (neighbors == null) {
                    neighbors = new ArrayList<>();
                    edges.put(node, neighbors);
                }
                return neighbors;
            }

            void addBiEdge(Long a, Long b) {
                addEdge(a, b);
                addEdge(b, a);
            }

            void addEdge(Long from, Long to) {
                getSetNeighbors(to); // make sure all have initialized lists
                List<Long> neighbors = getSetNeighbors(from);
                neighbors.add(to);
            }

            // topoSort variables
            int UNTOUCHED = 0;
            int FINISHED = 2;
            int INPROGRESS = 1;
            HashMap<Long, Integer> vis;
            List<Long> topoAns;
            List<Long> failDueToCycle = new ArrayList<Long>() {{ add(-1L); }};

            List<Long> topoSort() {
                topoAns = new ArrayList<>();
                vis = new HashMap<>();
                for (Long a : edges.keySet()) {
                    if (!topoDFS(a)) return failDueToCycle;
                }
                Collections.reverse(topoAns);
                return topoAns;
            }

            boolean topoDFS(long curr) {
                Integer status = vis.get(curr);
                if (status == null) status = UNTOUCHED;
                if (status == FINISHED) return true;
                if (status == INPROGRESS) {
                    return false;
                }
                vis.put(curr, INPROGRESS);
                for (long next : edges.get(curr)) {
                    if (!topoDFS(next)) return false;
                }
                vis.put(curr, FINISHED);
                topoAns.add(curr);
                return true;
            }

        }

        class Point {
            int y;
            int x;

            public Point(int y, int x) {
                this.y = y;
                this.x = x;
            }
        }

        class IDval implements Comparable<IDval> {
            int id;
            long val;

            public IDval(int id, long val) {
                this.val = val;
                this.id = id;
            }

            @Override
            public int compareTo(IDval o) {
                if (this.val < o.val) return -1;
                if (this.val > o.val) return 1;
                return this.id - o.id;
            }
        }

        long pow(long base, int exp) {
            if (exp == 0) return 1L;
            long x = pow(base, exp/2);
            long ans = x * x;
            if (exp % 2 != 0) ans *= base;
            return ans;
        }

        long gcd(long... v) {
            /** Chained calls to Euclidean algorithm. */
            if (v.length == 1) return v[0];
            long ans = gcd(v[1], v[0]);
            for (int i=2; i<v.length; i++) {
                ans = gcd(ans, v[i]);
            }
            return ans;
        }

        long gcd(long a, long b) {
            /** Euclidean algorithm. */
            if (b == 0) return a;
            return gcd(b, a%b);
        }

        int[] generatePrimesUpTo(int last) {
            /* Sieve of Eratosthenes. Practically O(n). Values of 0 indicate primes. */
            int[] div = new int[last+1];
            for (int x=2; x<=last; x++) {
                if (div[x] > 0) continue;
                for (int u=2*x; u<=last; u+=x) {
                    div[u] = x;
                }
            }
            return div;
        }

        long lcm(long a, long b) {
            /** Least common multiple */
            return a * b / gcd(a,b);
        }

        private class ElementCounter {
            private HashMap<Long, Integer> elements;

            public ElementCounter() {
                elements = new HashMap<>();
            }

            public void add(long element) {
                int count = 1;
                Integer prev = elements.get(element);
                if (prev != null) count += prev;
                elements.put(element, count);
            }

            public void remove(long element) {
                int count = elements.remove(element);
                count--;
                if (count > 0) elements.put(element, count);
            }

            public int get(long element) {
                Integer val = elements.get(element);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class StringCounter {
            HashMap<String, Integer> elements;

            public StringCounter() {
                elements = new HashMap<>();
            }

            public void add(String identifier) {
                int count = 1;
                Integer prev = elements.get(identifier);
                if (prev != null) count += prev;
                elements.put(identifier, count);
            }

            public void remove(String identifier) {
                int count = elements.remove(identifier);
                count--;
                if (count > 0) elements.put(identifier, count);
            }

            public long get(String identifier) {
                Integer val = elements.get(identifier);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class DisjointSet {
            /** Union Find / Disjoint Set data structure. */
            int[] size;
            int[] parent;
            int componentCount;

            public DisjointSet(int n) {
                componentCount = n;
                size = new int[n];
                parent = new int[n];
                for (int i=0; i<n; i++) parent[i] = i;
                for (int i=0; i<n; i++) size[i] = 1;
            }

            public void join(int a, int b) {
                /* Find roots */
                int rootA = parent[a];
                int rootB = parent[b];
                while (rootA != parent[rootA]) rootA = parent[rootA];
                while (rootB != parent[rootB]) rootB = parent[rootB];

                if (rootA == rootB) {
                    /* Already in the same set */
                    return;
                }

                /* Merge smaller set into larger set. */
                if (size[rootA] > size[rootB]) {
                    size[rootA] += size[rootB];
                    parent[rootB] = rootA;
                } else {
                    size[rootB] += size[rootA];
                    parent[rootA] = rootB;
                }
                componentCount--;
            }

        }

        class LCAFinder {

            /* O(n log n) Initialize: new LCAFinder(graph)
             * O(log n) Queries: find(a,b) returns lowest common ancestor for nodes a and b */

            int[] nodes;
            int[] depths;
            int[] entries;
            int pointer;
            FenwickMin fenwick;

            public LCAFinder(List<Integer>[] graph) {
                this.nodes = new int[(int)10e6];
                this.depths = new int[(int)10e6];
                this.entries = new int[graph.length];
                this.pointer = 1;
                boolean[] visited = new boolean[graph.length+1];
                dfs(1, 0, graph, visited);
                fenwick = new FenwickMin(pointer-1);
                for (int i=1; i<pointer; i++) {
                    fenwick.set(i, depths[i] * 1000000L + i);
                }
            }

            private void dfs(int node, int depth, List<Integer>[] graph, boolean[] visited) {
                visited[node] = true;
                entries[node] = pointer;
                nodes[pointer] = node;
                depths[pointer] = depth;
                pointer++;
                for (int neighbor : graph[node]) {
                    if (visited[neighbor]) continue;
                    dfs(neighbor, depth+1, graph, visited);
                    nodes[pointer] = node;
                    depths[pointer] = depth;
                    pointer++;
                }
            }

            public int find(int a, int b) {
                int left = entries[a];
                int right = entries[b];
                if (left > right) {
                    int temp = left;
                    left = right;
                    right = temp;
                }
                long mixedBag = fenwick.getMin(left, right);
                int index = (int) (mixedBag % 1000000L);
                return nodes[index];
            }
        }

        class FenwickMin {
            long n;
            long[] original;
            long[] bottomUp;
            long[] topDown;

            public FenwickMin(int n) {
                this.n = n;
                original = new long[n+2];
                bottomUp = new long[n+2];
                topDown = new long[n+2];
            }

            public void set(int modifiedNode, long value) {
                long replaced = original[modifiedNode];
                original[modifiedNode] = value;
                // Update left tree
                int i = modifiedNode;
                long v = value;
                while (i <= n) {
                    if (v > bottomUp[i]) {
                        if (replaced == bottomUp[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i-x;
                                v = Math.min(v, bottomUp[child]);
                            }
                        } else break;
                    }
                    if (v == bottomUp[i]) break;
                    bottomUp[i] = v;
                    i += (i&-i);
                }
                // Update right tree
                i = modifiedNode;
                v = value;
                while (i > 0) {
                    if (v > topDown[i]) {
                        if (replaced == topDown[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i+x;
                                if (child > n+1) break;
                                v = Math.min(v, topDown[child]);
                            }
                        } else break;
                    }
                    if (v == topDown[i]) break;
                    topDown[i] = v;
                    i -= (i&-i);
                }
            }

            public long getMin(int a, int b) {
                long min = original[a];
                int prev = a;
                int curr = prev + (prev&-prev); // parent right hand side
                while (curr <= b) {
                    min = Math.min(min, topDown[prev]); // value from the other tree
                    prev = curr;
                    curr = prev + (prev&-prev);;
                }
                min = Math.min(min, original[prev]);
                prev = b;
                curr = prev - (prev&-prev); // parent left hand side
                while (curr >= a) {
                    min = Math.min(min,bottomUp[prev]); // value from the other tree
                    prev = curr;
                    curr = prev - (prev&-prev);
                }
                return min;
            }

        }

        class FenwickSum {
            public long[] d;

            public FenwickSum(int n) {
                d=new long[n+1];
            }

            /** a[0] must be unused. */
            public FenwickSum(long[] a) {
                d=new long[a.length];
                for (int i=1; i<a.length; i++) {
                    modify(i, a[i]);
                }
            }

            /** Do not modify i=0. */
            void modify(int i, long v) {
                while (i<d.length) {
                    d[i] += v;
                    // Move to next uplink on the RIGHT side of i
                    i += (i&-i);
                }
            }

            /** Returns sum from a to b, *BOTH* inclusive. */
            long getSum(int a, int b) {
                return getSum(b) - getSum(a-1);
            }

            private long getSum(int i) {
                long sum = 0;
                while (i>0) {
                    sum += d[i];
                    // Move to next uplink on the LEFT side of i
                    i -= (i&-i);
                }
                return sum;
            }
        }

        class SegmentTree {
            /** Query sums with log(n) modifyRange */
            int N;
            long[] p;

            public SegmentTree(int n) {
                /* TODO: Test that this works. */
                for (N=2; N<n; N++) N *= 2;
                p = new long[2*N];
            }

            public void modifyRange(int a, int b, long change) {
                muuta(a, change);
                muuta(b+1, -change);
            }

            void muuta(int k, long muutos) {
                k += N;
                p[k] += muutos;
                for (k /= 2; k >= 1; k /= 2) {
                    p[k] = p[2*k] + p[2*k+1];
                }
            }

            public long get(int k) {
                int a = N;
                int b = k+N;
                long s = 0;
                while (a <= b) {
                    if (a%2 == 1) s += p[a++];
                    if (b%2 == 0) s += p[b--];
                    a /= 2;
                    b /= 2;
                }
                return s;
            }

        }

        class Zalgo {

            public int pisinEsiintyma(String haku, String kohde) {
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                int max = 0;
                for (int i=haku.length(); i<z.length; i++) {
                    max = Math.max(max, z[i]);
                }
                return max;
            }

            public int[] toZarray(char[] s) {
                int n = s.length;
                int[] z = new int[n];
                int a = 0, b = 0;
                for (int i = 1; i < n; i++) {
                    if (i > b) {
                        for (int j = i; j < n && s[j - i] == s[j]; j++)  z[i]++;
                    }
                    else {
                        z[i] = z[i - a];
                        if (i + z[i - a] > b) {
                            for (int j = b + 1; j < n && s[j - i] == s[j]; j++) z[i]++;
                            a = i;
                            b = i + z[i] - 1;
                        }
                    }
                }
                return z;
            }

            public List<Integer> getStartIndexesWhereWordIsFound(String haku, String kohde) {
                // this is alternative use case
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                List<Integer> indexes = new ArrayList<>();
                for (int i=haku.length(); i<z.length; i++) {
                    if (z[i] < haku.length()) continue;
                    indexes.add(i);
                }
                return indexes;
            }

        }

        class StringHasher {

            class HashedString {
                long[] hashes;
                long[] modifiers;

                public HashedString(long[] hashes, long[] modifiers) {
                    this.hashes = hashes;
                    this.modifiers = modifiers;
                }
            }

            long P;
            long M;

            public StringHasher() {
                initializePandM();
            }

            HashedString hashString(String s) {
                int n = s.length();
                long[] hashes = new long[n];
                long[] modifiers = new long[n];
                hashes[0] = s.charAt(0);
                modifiers[0] = 1;
                for (int i=1; i<n; i++) {
                    hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    modifiers[i] = (modifiers[i-1] * P) % M;
                }
                return new HashedString(hashes, modifiers);
            }

            /**
             * Indices are inclusive.
             */
            long getHash(HashedString hashedString, int startIndex, int endIndex) {
                long[] hashes = hashedString.hashes;
                long[] modifiers = hashedString.modifiers;
                long result = hashes[endIndex];
                if (startIndex > 0) result -= (hashes[startIndex-1] * modifiers[endIndex-startIndex+1]) % M;
                if (result < 0) result += M;
                return result;
            }

            // Less interesting methods below

            /**
             * Efficient for 2 input parameter strings in particular.
             */
            HashedString[] hashString(String first, String second) {
                HashedString[] array = new HashedString[2];
                int n = first.length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;

                long[] firstHashes = new long[n];
                firstHashes[0] = first.charAt(0);
                array[0] = new HashedString(firstHashes, modifiers);

                long[] secondHashes = new long[n];
                secondHashes[0] = second.charAt(0);
                array[1] = new HashedString(secondHashes, modifiers);

                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    firstHashes[i] = (firstHashes[i-1] * P + first.charAt(i)) % M;
                    secondHashes[i] = (secondHashes[i-1] * P + second.charAt(i)) % M;
                }
                return array;
            }

            /**
             * Efficient for 3+ strings
             * More efficient than multiple hashString calls IF strings are same length.
             */
            HashedString[] hashString(String... strings) {
                HashedString[] array = new HashedString[strings.length];
                int n = strings[0].length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;
                for (int j=0; j<strings.length; j++) {
                    // if all strings are not same length, defer work to another method
                    if (strings[j].length() != n) {
                        for (int i=0; i<n; i++) {
                            array[i] = hashString(strings[i]);
                        }
                        return array;
                    }

                    // otherwise initialize stuff
                    long[] hashes = new long[n];
                    hashes[0] = strings[j].charAt(0);
                    array[j] = new HashedString(hashes, modifiers);
                }
                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    for (int j=0; j<strings.length; j++) {
                        String s = strings[j];
                        long[] hashes = array[j].hashes;
                        hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    }
                }
                return array;
            }

            void initializePandM() {
                ArrayList<Long> modOptions = new ArrayList<>(20);
                modOptions.add(353873237L);
                modOptions.add(353875897L);
                modOptions.add(353878703L);
                modOptions.add(353882671L);
                modOptions.add(353885303L);
                modOptions.add(353888377L);
                modOptions.add(353893457L);
                P = modOptions.get(new Random().nextInt(modOptions.size()));

                modOptions.clear();
                modOptions.add(452940277L);
                modOptions.add(452947687L);
                modOptions.add(464478431L);
                modOptions.add(468098221L);
                modOptions.add(470374601L);
                modOptions.add(472879717L);
                modOptions.add(472881973L);
                M = modOptions.get(new Random().nextInt(modOptions.size()));

            }
        }

        private static class Prob {

            /** For heavy calculations on probabilities, this class
             *  provides more accuracy & efficiency than doubles.
             *  Math explained: https://en.wikipedia.org/wiki/Log_probability
             *  Quick start:
             *      - Instantiate probabilities, eg. Prob a = new Prob(0.75)
             *      - add(), multiply() return new objects, can perform on nulls & NaNs.
             *      - get() returns probability as a readable double */

            /** Logarithmized probability. Note: 0% represented by logP NaN. */
            private double logP;

            /** Construct instance with real probability. */
            public Prob(double real) {
                if (real > 0) this.logP = Math.log(real);
                else this.logP = Double.NaN;
            }

            /** Construct instance with already logarithmized value. */
            static boolean dontLogAgain = true;
            public Prob(double logP, boolean anyBooleanHereToChooseThisConstructor) {
                this.logP = logP;
            }

            /** Returns real probability as a double. */
            public double get() {
                return Math.exp(logP);
            }

            @Override
            public String toString() {
                return ""+get();
            }

            /***************** STATIC METHODS BELOW ********************/

            /** Note: returns NaN only when a && b are both NaN/null. */
            public static Prob add(Prob a, Prob b) {
                if (nullOrNaN(a) && nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                if (nullOrNaN(a)) return copy(b);
                if (nullOrNaN(b)) return copy(a);

                double x = Math.max(a.logP, b.logP);
                double y = Math.min(a.logP, b.logP);
                double sum = x + Math.log(1 + Math.exp(y - x));
                return new Prob(sum, dontLogAgain);
            }

            /** Note: multiplying by null or NaN produces NaN (repping 0% real prob). */
            public static Prob multiply(Prob a, Prob b) {
                if (nullOrNaN(a) || nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                return new Prob(a.logP + b.logP, dontLogAgain);
            }

            /** Returns true if p is null or NaN. */
            private static boolean nullOrNaN(Prob p) {
                return (p == null || Double.isNaN(p.logP));
            }

            /** Returns a new instance with the same value as original. */
            private static Prob copy(Prob original) {
                return new Prob(original.logP, dontLogAgain);
            }
        }

        public class StronglyConnectedComponents {

            /** Kosaraju's algorithm */

            ArrayList<Integer>[] forw;
            ArrayList<Integer>[] bacw;

            /** Use: getCount(2, new int[] {1,2}, new int[] {2,1}) */
            public int getCount(int n, int[] mista, int[] minne) {
                forw = new ArrayList[n+1];
                bacw = new ArrayList[n+1];
                for (int i=1; i<=n; i++) {
                    forw[i] = new ArrayList<Integer>();
                    bacw[i] = new ArrayList<Integer>();
                }
                for (int i=0; i<mista.length; i++) {
                    int a = mista[i];
                    int b = minne[i];
                    forw[a].add(b);
                    bacw[b].add(a);
                }
                int count = 0;
                List<Integer> list = new ArrayList<Integer>();
                boolean[] visited = new boolean[n+1];
                for (int i=1; i<=n; i++) {
                    dfsForward(i, visited, list);
                }
                visited = new boolean[n+1];
                for (int i=n-1; i>=0; i--) {
                    int node = list.get(i);
                    if (visited[node]) continue;
                    count++;
                    dfsBackward(node, visited);
                }
                return count;
            }

            public void dfsForward(int i, boolean[] visited, List<Integer> list) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : forw[i]) {
                    dfsForward(neighbor, visited, list);
                }
                list.add(i);
            }

            public void dfsBackward(int i, boolean[] visited) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : bacw[i]) {
                    dfsBackward(neighbor, visited);
                }
            }
        }

        class DrawGrid {

            void draw(boolean[][] d) {
                System.out.print("  ");
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(" " + x + " ");
                }
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print((d[y][x] ? "[x]" : "[ ]"));
                    }
                    System.out.println("");
                }
            }

            void draw(int[][] d) {
                int max = 1;
                for (int y=0; y<d.length; y++) {
                    for (int x=0; x<d[0].length; x++) {
                        max = Math.max(max, ("" + d[y][x]).length());
                    }
                }
                System.out.print("  ");
                String format = "%" + (max+2) + "s";
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(String.format(format, x) + " ");
                }
                format = "%" + (max) + "s";
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print(" [" + String.format(format, (d[y][x])) + "]");
                    }
                    System.out.println("");
                }
            }

        }

        class BaseConverter {

            /* Palauttaa luvun esityksen kannassa base */
            public String convert(Long number, int base) {
                return Long.toString(number, base);
            }

            /* Palauttaa luvun esityksen kannassa baseTo, kun annetaan luku Stringinä kannassa baseFrom */
            public String convert(String number, int baseFrom, int baseTo) {
                return Long.toString(Long.parseLong(number, baseFrom), baseTo);
            }

            /* Tulkitsee kannassa base esitetyn luvun longiksi (kannassa 10) */
            public long longify(String number, int baseFrom) {
                return Long.parseLong(number, baseFrom);
            }
        }

        class Binary implements Comparable<Binary> {

            /**
             * Use example: Binary b = new Binary(Long.toBinaryString(53249834L));
             *
             * When manipulating small binary strings, instantiate new Binary(string)
             * When just reading large binary strings, instantiate new Binary(string,true)
             * get(int i) returns a character '1' or '0', not an int.
             */

            private boolean[] d;
            private int first; // Starting from left, the first (most remarkable) '1'
            public int length;

            public Binary(String binaryString) {
                this(binaryString, false);
            }
            public Binary(String binaryString, boolean initWithMinArraySize) {
                length = binaryString.length();
                int size = Math.max(2*length, 1);
                first = length/4;
                if (initWithMinArraySize) {
                    first = 0;
                    size = Math.max(length, 1);
                }
                d = new boolean[size];
                for (int i=0; i<length; i++) {
                    if (binaryString.charAt(i) == '1') d[i+first] = true;
                }
            }

            public void addFirst(char c) {
                if (first-1 < 0) doubleArraySize();
                first--;
                d[first] = (c == '1' ? true : false);
                length++;
            }

            public void addLast(char c) {
                if (first+length >= d.length) doubleArraySize();
                d[first+length] = (c == '1' ? true : false);
                length++;
            }

            private void doubleArraySize() {
                boolean[] bigArray = new boolean[(d.length+1) * 2];
                int newFirst = bigArray.length / 4;
                for (int i=0; i<length; i++) {
                    bigArray[i + newFirst] = d[i + first];
                }
                first = newFirst;
                d = bigArray;
            }

            public boolean flip(int i) {
                boolean value = (this.d[first+i] ? false : true);
                this.d[first+i] = value;
                return value;
            }

            public void set(int i, char c) {
                boolean value = (c == '1' ? true : false);
                this.d[first+i] = value;
            }

            public char get(int i) {
                return (this.d[first+i] ? '1' : '0');
            }

            @Override
            public int compareTo(Binary o) {
                if (this.length != o.length) return this.length - o.length;
                int len = this.length;
                for (int i=0; i<len; i++) {
                    int diff = this.get(i) - o.get(i);
                    if (diff != 0) return diff;
                }
                return 0;
            }

            @Override
            public String toString() {
                StringBuilder sb = new StringBuilder();
                for (int i=0; i<length; i++) {
                    sb.append(d[i+first] ? '1' : '0');
                }
                return sb.toString();
            }

        }

        class BinomialCoefficients {
            /** Total number of K sized unique combinations from pool of size N (unordered)
             N! / ( K! (N - K)! )   */

            /** For simple queries where output fits in long. */
            public long biCo(long n, long k) {
                long r = 1;
                if (k > n) return 0;
                for (long d = 1; d <= k; d++) {
                    r *= n--;
                    r /= d;
                }
                return r;
            }

            /** For multiple queries with same n, different k. */
            public long[] precalcBinomialCoefficientsK(int n, int maxK) {
                long v[] = new long[maxK+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,maxK); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                    }
                }
                return v;
            }

            /** When output needs % MOD. */
            public long[] precalcBinomialCoefficientsK(int n, int k, long M) {
                long v[] = new long[k+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,k); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                        v[j] %= M;
                    }
                }
                return v;
            }
        }

        class Trie {
            int N;
            int Z;
            int nextFreeId;
            int[][] pointers;
            boolean[] end;

            /** maxLenSum = maximum possible sum of length of words */
            public Trie(int maxLenSum, int alphabetSize) {
                this.N = maxLenSum;
                this.Z = alphabetSize;
                this.nextFreeId = 1;
                pointers = new int[N+1][alphabetSize];
                end = new boolean[N+1];
            }

            public void addWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) {
                        next = nextFreeId++;
                        pointers[curr][c] = next;
                    }
                    curr = next;
                }
                end[curr] = true;
            }

            public boolean hasWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) return false;
                    curr = next;
                }
                return end[curr];
            }

        }

        private class IO extends PrintWriter {
            private InputStreamReader r;
            private static final int BUFSIZE = 1 << 15;
            private char[] buf;
            private int bufc;
            private int bufi;
            private StringBuilder sb;

            public IO() {
                super(new BufferedOutputStream(System.out));
                r = new InputStreamReader(System.in);

                buf = new char[BUFSIZE];
                bufc = 0;
                bufi = 0;
                sb = new StringBuilder();
            }

            /** Print, flush, return nextInt. */
            private int queryInt(String s) {
                io.println(s);
                io.flush();
                return nextInt();
            }

            /** Print, flush, return nextLong. */
            private long queryLong(String s) {
                io.println(s);
                io.flush();
                return nextLong();
            }

            /** Print, flush, return next word. */
            private String queryNext(String s) {
                io.println(s);
                io.flush();
                return next();
            }

            private void fillBuf() throws IOException {
                bufi = 0;
                bufc = 0;
                while(bufc == 0) {
                    bufc = r.read(buf, 0, BUFSIZE);
                    if(bufc == -1) {
                        bufc = 0;
                        return;
                    }
                }
            }

            private boolean pumpBuf() throws IOException {
                if(bufi == bufc) {
                    fillBuf();
                }
                return bufc != 0;
            }

            private boolean isDelimiter(char c) {
                return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';
            }

            private void eatDelimiters() throws IOException {
                while(true) {
                    if(bufi == bufc) {
                        fillBuf();
                        if(bufc == 0) throw new RuntimeException("IO: Out of input.");
                    }

                    if(!isDelimiter(buf[bufi])) break;
                    ++bufi;
                }
            }

            public String next() {
                try {
                    sb.setLength(0);

                    eatDelimiters();
                    int start = bufi;

                    while(true) {
                        if(bufi == bufc) {
                            sb.append(buf, start, bufi - start);
                            fillBuf();
                            start = 0;
                            if(bufc == 0) break;
                        }

                        if(isDelimiter(buf[bufi])) break;
                        ++bufi;
                    }

                    sb.append(buf, start, bufi - start);

                    return sb.toString();
                } catch(IOException e) {
                    throw new RuntimeException("IO.next: Caught IOException.");
                }
            }

            public int nextInt() {
                try {
                    int ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextInt: Invalid int.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");
                            ret *= 10;
                            ret -= (int)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");
                        } else {
                            throw new RuntimeException("IO.nextInt: Invalid int.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextInt: Caught IOException.");
                }
            }

            public long nextLong() {
                try {
                    long ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextLong: Invalid long.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");
                            ret *= 10;
                            ret -= (long)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");
                        } else {
                            throw new RuntimeException("IO.nextLong: Invalid long.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextLong: Caught IOException.");
                }
            }

            public double nextDouble() {
                return Double.parseDouble(next());
            }

        }

        void print(Object output) {
            io.println(output);
        }

        void done(Object output) {
            print(output);
            done();
        }

        void done() {
            io.close();
            throw new RuntimeException("Clean exit");
        }

        long min(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        double min(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        int min(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        long max(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        double max(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        int max(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

    }

}

import java.util.Scanner;

//http://codeforces.com/contest/994/problem/C
public class TwoSquares {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] sq1 = sc.nextLine().split(" ");
        String[] sq2 = sc.nextLine().split(" ");
        int minXs1 = Integer.MAX_VALUE;
        int minXs2 = Integer.MAX_VALUE;
        int maxXs1 = Integer.MIN_VALUE;
        int maxXs2 = Integer.MIN_VALUE;
        int minYs1 = Integer.MAX_VALUE;
        int minYs2 = Integer.MAX_VALUE;
        int maxYs1 = Integer.MIN_VALUE;
        int maxYs2 = Integer.MIN_VALUE;
        for (int i = 0; i < sq1.length; i++) {
            if (i % 2 == 0) {
                int x1 = Integer.parseInt(sq1[i]) * 2;
                int x2 = Integer.parseInt(sq2[i]) * 2;
                minXs1 = Math.min(minXs1, x1);
                minXs2 = Math.min(minXs2, x2);
                maxXs1 = Math.max(maxXs1, x1);
                maxXs2 = Math.max(maxXs2, x2);
            } else {
                int y1 = Integer.parseInt(sq1[i]) * 2;
                int y2 = Integer.parseInt(sq2[i]) * 2;
                minYs1 = Math.min(minYs1, y1);
                minYs2 = Math.min(minYs2, y2);
                maxYs1 = Math.max(maxYs1, y1);
                maxYs2 = Math.max(maxYs2, y2);
            }
        }
        int centerXs1 = (minXs1 + maxXs1) / 2;
        int centerYs1 = (minYs1 + maxYs1) / 2;
        int centerXs2 = (minXs2 + maxXs2) / 2;
        int centerYs2 = (minYs2 + maxYs2) / 2;
        int s = maxXs1 - minXs1;
        int d = (maxXs2 - minXs2) / 2;
        int centDist = Math.abs(centerXs1 - centerXs2) + Math.abs(centerYs1- centerYs2);
        if (centDist > s + 3 * d) {
            System.out.println("NO");
        } else {
            if(maxYs2 <= centerYs1 + s / 2 + d && minYs1 >= centerYs1 - s / 2 - d &&
                    maxXs2 <= centerXs1 + s / 2 + d && minXs1 >= centerXs1 - s / 2 - d) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}

import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
public class templ implements Runnable {
    public static ArrayList<Integer> g[]=new ArrayList[1000000];
    public static int vis[]=new int[1000000];
    public static int m[]=new int [1000000];
    public static int k=0;
    void dfs(int n,int p)
    {
        vis[n]=1;
        for(int i=0;i<g[n].size();i++)
        {
            int u=g[n].get(i);
            if(u==p)
                continue;
            else if(vis[u]==0)
            {
                dfs(u,n);
                m[n]=m[n]|m[u];
            }
        }
    }
    int binarySearch(int arr[], int l, int r, int x)
    {
        if (r >= l)
        {
            int mid = l + (r - l)/2;
            if (arr[mid] == x)
                return mid;
            if (arr[mid] > x)
                return binarySearch(arr, l, mid-1, x);
            return binarySearch(arr, mid+1, r, x);
        }
        return -1;
    }
    void merge1(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i]<=R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    void sort1(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort1(arr, l, m);
            sort1(arr , m+1, r);
            merge1(arr, l, m, r);
        }
    }
    void merge3(int arr[],int arr1[],int arr2[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        int L2[]=new int[n1];
        int R2[]=new int[n2];
        //long L3[]=new long[n1];
        //long R3[]=new long[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
            L2[i]=arr2[l+i];
            //L3[i]=arr3[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
            R2[j]=arr2[m+1+j];
            //R3[j]=arr3[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                arr2[k]=L2[i];
                //arr3[k]=L3[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                arr2[k]=R2[j];
                //arr3[k]=R3[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            arr2[k]=L2[i];
            //arr3[k]=L3[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            arr2[k]=R2[j];
            //arr3[k]=R3[j];
            j++;
            k++;
        }
    }
    void sort3(int arr[],int arr1[],int arr2[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort3(arr,arr1,arr2, l, m);
            sort3(arr ,arr1,arr2, m+1, r);
            merge3(arr,arr1,arr2,l, m, r);
        }
    }
    void merge2(int arr[],int arr1[],int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            j++;
            k++;
        }
    }
    void sort2(int arr[],int arr1[],int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort2(arr,arr1, l, m);
            sort2(arr ,arr1, m+1, r);
            merge2(arr,arr1,l, m, r);
        }
    }
    void merge4(int arr[],int arr1[],int arr2[],int arr3[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        int L1[]=new int[n1];
        int R1[]=new int[n2];
        int L2[]=new int[n1];
        int R2[]=new int[n2];
        int L3[]=new int[n1];
        int R3[]=new int[n2];
        for (int i=0; i<n1; ++i)
        {
            L[i] = arr[l + i];
            L1[i]=arr1[l+i];
            L2[i]=arr2[l+i];
            L3[i]=arr3[l+i];
        }
        for (int j=0; j<n2; ++j)
        {
            R[j] = arr[m + 1+ j];
            R1[j]=arr1[m+1+j];
            R2[j]=arr2[m+1+j];
            R3[j]=arr3[m+1+j];
        }
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                arr1[k]=L1[i];
                arr2[k]=L2[i];
                arr3[k]=L3[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                arr1[k]=R1[j];
                arr2[k]=R2[j];
                arr3[k]=R3[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            arr1[k]=L1[i];
            arr2[k]=L2[i];
            arr3[k]=L3[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            arr1[k]=R1[j];
            arr2[k]=R2[j];
            arr3[k]=R3[j];
            j++;
            k++;
        }
    }
    void sort4(int arr[],int arr1[],int arr2[],int arr3[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort4(arr,arr1,arr2,arr3, l, m);
            sort4(arr ,arr1,arr2,arr3, m+1, r);
            merge4(arr,arr1,arr2,arr3,l, m, r);
        }
    }
    public int justsmall(int a[],int l,int r,int x)
    {
        int p=-1;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<=x)
            {
                p=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        return p;
    }
    public int justlarge(int a[],int l,int r,int x)
    {
        int p=0;
        while(l<=r)
        {
            int mid=(l+r)/2;
            if(a[mid]<=x)
            {
                l=mid+1;
            }
            else
            {
                p=a[mid];
                r = mid - 1;
            }
        }
        return p;
    }
    static float area(int x1, int y1, int x2, int y2, int x3, int y3)
    {
        return (float)Math.abs((x1 * (y2 - y3) +
                x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
    }
    static boolean check(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int x, int y)
    {
        float A = area(x1, y1, x2, y2, x3, y3)+ area(x1, y1, x4, y4, x3, y3);
        float A1 = area(x, y, x1, y1, x2, y2);
        float A2 = area(x, y, x2, y2, x3, y3);
        float A3 = area(x, y, x3, y3, x4, y4);
        float A4 = area(x, y, x1, y1, x4, y4);
        return (A == A1 + A2 + A3 + A4);
    }
    public static void main(String args[])throws Exception
    {
        new Thread(null,new templ(),"templ",1<<26).start();
    }
    public void run() {
        try
        {
            InputReader in = new InputReader(System.in);
            PrintWriter out = new PrintWriter(System.out);
            templ ob=new templ();
            int a1=in.ni();
            int a2=in.ni();
            int b1=in.ni();
            int b2=in.ni();
            int c1=in.ni();
            int c2=in.ni();
            int d1=in.ni();
            int d2=in.ni();
            int p1=in.ni();
            int p2=in.ni();
            int q1=in.ni();
            int q2=in.ni();
            int r1=in.ni();
            int r2=in.ni();
            int s1=in.ni();
            int s2=in.ni();
            if(check(a1,a2,b1,b2,c1,c2,d1,d2,p1,p2)||check(a1,a2,b1,b2,c1,c2,d1,d2,q1,q2)||check(a1,a2,b1,b2,c1,c2,d1,d2,r1,r2)||check(a1,a2,b1,b2,c1,c2,d1,d2,s1,s2)||check(p1,p2,q1,q2,r1,r2,s1,s2,a1,a2)||check(p1,p2,q1,q2,r1,r2,s1,s2,b1,b2)||check(p1,p2,q1,q2,r1,r2,s1,s2,c1,c2)||check(p1,p2,q1,q2,r1,r2,s1,s2,d1,d2))
                out.println("YES");
            else
                out.println("NO");
            out.close();
        }
        catch(Exception e){
            return;
        }
    }
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nl() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vadim Semenov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static final class TaskC {
        public void solve(int __, InputReader in, PrintWriter out) {
            int[][] fst = new int[4][2];
            int[][] snd = new int[4][2];
            for (int i = 0; i < 4; ++i) {
                for (int coord = 0; coord < 2; ++coord) {
                    fst[i][coord] = 2 * in.nextInt();
                }
            }
            for (int i = 0; i < 4; ++i) {
                for (int coord = 0; coord < 2; ++coord) {
                    snd[i][coord] = 2 * in.nextInt();
                }
            }
            if (inside(getMidPoint(fst), snd) || inside(getMidPoint(snd), fst)) {
                out.println("YES");
                return;
            }
            for (int i = 0; i < 4; ++i) {
                if (inside(fst[i], snd)) {
                    out.println("YES");
                    return;
                }
            }
            for (int i = 0; i < 4; ++i) {
                if (inside(snd[i], fst)) {
                    System.out.println("snd " + i);
                    out.println("YES");
                    return;
                }
            }
            out.println("NO");
        }

        private int[] getMidPoint(int[][] square) {
            int[] mid = new int[2];
            for (int i = 0; i < 4; ++i) {
                mid[0] += square[i][0];
                mid[1] += square[i][1];
            }
            mid[0] /= 4;
            mid[1] /= 4;
            return mid;
        }

        private boolean inside(int[] point, int[][] square) {
            for (int i = 0; i < 4; ++i) {
                int j = (i + 1) % 4;
                if (between(square[i], square[j], point)) {
                    return true;
                }
            }
            boolean predicate = ccw(square[3], square[0], point);
            for (int i = 0; i < 3; ++i) {
                if (predicate != ccw(square[i], square[i + 1], point)) {
                    return false;
                }
            }
            return true;
        }

        private boolean ccw(int[] a, int[] b, int[] c) {
            return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]) > 0;
        }

        private boolean between(int[] a, int[] b, int[] p) {
            if (Arrays.equals(a, p) || Arrays.equals(b, p)) {
                return true;
            }
            return (b[0] - a[0]) * (p[1] - a[1]) == (b[1] - a[1]) * (p[0] - a[0]) &&
                    Integer.signum(p[0] - a[0]) == Integer.signum(b[0] - p[0]) &&
                    Integer.signum(p[1] - a[1]) == Integer.signum(b[1] - p[1]);
        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }
}

import java.util.Scanner;

public class TwoSquares {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] sq1 = sc.nextLine().split(" ");
        String[] sq2 = sc.nextLine().split(" ");
        int minXs1 = Integer.MAX_VALUE;
        int minXs2 = Integer.MAX_VALUE;
        int maxXs1 = Integer.MIN_VALUE;
        int maxXs2 = Integer.MIN_VALUE;
        int minYs1 = Integer.MAX_VALUE;
        int minYs2 = Integer.MAX_VALUE;
        int maxYs1 = Integer.MIN_VALUE;
        int maxYs2 = Integer.MIN_VALUE;
        for (int i = 0; i < sq1.length; i++) {
            if (i % 2 == 0) {
                int x1 = Integer.parseInt(sq1[i]) * 2;
                int x2 = Integer.parseInt(sq2[i]) * 2;
                minXs1 = Math.min(minXs1, x1);
                minXs2 = Math.min(minXs2, x2);
                maxXs1 = Math.max(maxXs1, x1);
                maxXs2 = Math.max(maxXs2, x2);
            } else {
                int y1 = Integer.parseInt(sq1[i]) * 2;
                int y2 = Integer.parseInt(sq2[i]) * 2;
                minYs1 = Math.min(minYs1, y1);
                minYs2 = Math.min(minYs2, y2);
                maxYs1 = Math.max(maxYs1, y1);
                maxYs2 = Math.max(maxYs2, y2);
            }
        }
        int centerXs1 = (minXs1 + maxXs1)/2;
        int centerYs1 = (minYs1 + maxYs1)/2;
        int centerXs2 = (minXs2 + maxXs2)/2;
        int centerYs2 = (minYs2 + maxYs2)/2;
        int s = maxXs1 - minXs1;
        int d = (maxXs2 - minXs2) / 2;
        int centDist = Math.abs(centerXs1+centerYs1-centerXs2-centerYs2);
        if(centDist>s+3*d){
            System.out.println("NO");
        }else{
            if(Math.abs(centerYs1-centerYs2)<=s/2+d&& Math.abs(centerXs1-centerXs2)<=s/2+d){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }
    }
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        new Solver().run(1);
    }
}

class Solver {

    private BufferedReader reader = null;
    private StringTokenizer st = null;

    private Point[][] points = new Point[4][4];
    private boolean intersectionFound = false;

    public void run(int inputType) throws Exception {
        if (inputType == 0)
            reader = new BufferedReader(new FileReader("input.txt"));
        else
            reader = new BufferedReader(new InputStreamReader(System.in));

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < 4; ++i) {
            points[0][i] = new Point(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < 4; ++i) {
            points[1][i] = new Point(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        for (int i = 0; i < 2; ++i) {
            for (int j = 0; j < 4; ++j) {

                int nextSq = (i + 1) % 2;
                int res1 = crossProductSign(points[nextSq][0], points[nextSq][1], points[i][j]);
                int res2 = crossProductSign(points[nextSq][1], points[nextSq][2], points[i][j]);
                int res3 = crossProductSign(points[nextSq][2], points[nextSq][3], points[i][j]);
                int res4 = crossProductSign(points[nextSq][3], points[nextSq][0], points[i][j]);

                if ((res1 == 0 && inside(points[nextSq][0], points[nextSq][1], points[i][j]))
                        || (res2 == 0 && inside(points[nextSq][1], points[nextSq][2], points[i][j]))
                        || (res3 == 0 && inside(points[nextSq][2], points[nextSq][3], points[i][j]))
                        || (res4 == 0 && inside(points[nextSq][3], points[nextSq][0], points[i][j]))) {

                    intersectionFound = true;
                    break;
                }

                if (res1 == res2 && res2 == res3 && res3 == res4) {
                    intersectionFound = true;
                    break;
                }
            }

            if (intersectionFound)
                break;
        }

        if (!intersectionFound) {

            for (int i = 0; i < 4; ++i) {

                boolean res1 = inside(points[0][0], points[0][1], points[1][i]);
                boolean res2 = inside(points[0][1], points[0][2], points[1][(i + 1) % 4]);
                boolean res3 = inside(points[0][2], points[0][3], points[1][(i + 2) % 4]);
                boolean res4 = inside(points[0][3], points[0][0], points[1][(i + 3) % 4]);

                if (res1 && res2 && res3 && res4) {
                    intersectionFound = true;
                    break;
                }
            }
        }

        if (intersectionFound)
            System.out.println("YES");
        else
            System.out.println("NO");

        reader.close();
    }

    boolean inside(Point p1, Point p2, Point p3) {
        int xhigh = Math.max(p2.x, p1.x);
        int xlow = Math.min(p2.x, p1.x);
        int yhigh = Math.max(p2.y, p1.y);
        int ylow = Math.min(p2.y, p1.y);

        return p3.x >= xlow && p3.x <= xhigh && p3.y >= ylow && p3.y <= yhigh;
    }

    int crossProductSign(Point p1, Point p2, Point p3) {
        int res = (p2.x - p1.x) * (p3.y - p1.y) - (p2.y - p1.y) * (p3.x - p1.x);

        if (res < 0)
            return -1;

        if (res > 0)
            return 1;

        return 0;
    }

    class Point {
        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class C {
    static class Point {
        int x,y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Point point = (Point) o;
            return x == point.x &&
                    y == point.y;
        }

        @Override
        public int hashCode() {

            return Objects.hash(x, y);
        }

        @Override
        public String toString() {
            return x+","+y;
        }
    }
    static class Square {
        List<Point> points = new ArrayList<>();
    }

    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();

        Square A = readSquare(scanner);
        Square B = readSquare(scanner);

        Set<Point> regions = new HashSet<>();

        int minx = A.points.stream().mapToInt(Point::getX).min().getAsInt();
        int maxx = A.points.stream().mapToInt(Point::getX).max().getAsInt();
        int miny = A.points.stream().mapToInt(Point::getY).min().getAsInt();
        int maxy = A.points.stream().mapToInt(Point::getY).max().getAsInt();

        for (int x=minx; x < maxx; ++x) {
            for (int y=miny; y<maxy; ++y) {
                regions.add(new Point(x,y));
            }
        }

        minx = B.points.stream().mapToInt(Point::getX).min().getAsInt();
        maxx = B.points.stream().mapToInt(Point::getX).max().getAsInt();
        int midx=(minx+maxx)/2;
        miny = B.points.stream().mapToInt(Point::getY).min().getAsInt();
        maxy = B.points.stream().mapToInt(Point::getY).max().getAsInt();
        int midy=(miny+maxy)/2;

        for (int x=minx, d=1; x < midx; ++x, d++) {
            for (int y=midy-d; y<midy+d;++y) {
                if (regions.contains(new Point(x,y))) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        for (int x=maxx, d=1; x >= midx; --x, d++) {
            for (int y=midy-d; y<midy+d;++y) {
                if (regions.contains(new Point(x,y))) {
                    System.out.println("YES");
                    return;
                }
            }
        }

        for (Point p : A.points) {
            if (B.points.contains(p)) {
                System.out.println("YES");
                return;
            }
        }

        if (onside(A.points.get(0), A.points.get(1), B)||
                onside(A.points.get(1), A.points.get(2), B)||
                onside(A.points.get(2), A.points.get(3), B)||
                onside(A.points.get(3), A.points.get(0), B))  {
            System.out.println("YES");
            return;
        }

        System.out.println("NO");
    }

    private static boolean onside(Point a, Point b, Square H) {
        for (int x=Math.min(a.x, b.x); x<=Math.max(a.x,b.x);++x) {
            for (int y=Math.min(a.y, b.y); y <= Math.max(a.y, b.y); ++y) {
                if (H.points.contains(new Point(x,y))) {
                    return true;
                }
            }
        }
        return false;
    }

    private static Square readSquare(FastScanner scanner) {
        Square A = new Square();
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        return A;
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by Arihant Jain on 6/16/2018.
 */
public class twoSquares {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String out[] = br.readLine().split(" ");
        int parallelX[] = new int[4];
        int parallelY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            parallelX[i/2] = Integer.parseInt(out[i])+100;
            parallelY[i/2] = Integer.parseInt(out[i+1])+100;
        }
        int x1 = Math.min(parallelX[0],parallelX[2]);
        int x2 = Math.max(parallelX[0], parallelX[2]);
        int y1 = Math.min(parallelY[0],parallelY[2]);
        int y2 = Math.max(parallelY[0], parallelY[2]);
        out = br.readLine().split(" ");
        int diagonalGivenX[] = new int[4];
        int diagonalGivenY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            diagonalGivenX[i/2] = Integer.parseInt(out[i])+100;
            diagonalGivenY[i/2] = Integer.parseInt(out[i+1])+100;
        }
        int xMin = 0;
        int xMax = 0;
        int yMin = 0;
        int yMax = 0;
        for (int i =1; i<4; i++) {
            if (diagonalGivenX[i]<diagonalGivenX[xMin])
                xMin = i;
            if (diagonalGivenX[i]>diagonalGivenX[xMax])
                xMax = i;
            if (diagonalGivenY[i]<diagonalGivenY[yMin])
                yMin = i;
            if (diagonalGivenY[i]>diagonalGivenY[yMax])
                yMax = i;
        }
        int[] diagonalX = new int[4];
        int[] diagonalY = new int[4];
        diagonalX[0] = diagonalGivenX[xMin];
        diagonalX[1] = diagonalGivenX[yMax];
        diagonalX[2] = diagonalGivenX[xMax];
        diagonalX[3] = diagonalGivenX[yMin];
        diagonalY[0] = diagonalGivenY[xMin];
        diagonalY[1] = diagonalGivenY[yMax];
        diagonalY[2] = diagonalGivenY[xMax];
        diagonalY[3] = diagonalGivenY[yMin];
        for (int i =0; i<4; i++) {
            if (diagonalX[i]>=x1 && diagonalX[i]<= x2 && diagonalY[i]>=y1 && diagonalY[i]<=y2) {
                System.out.println("YES");
                return;
            }
        }
        for (int i =0; i<4; i++) {
            int x = parallelX[i];
            int y = parallelY[i];
            if (y<=x+diagonalY[0]-diagonalX[0] && y<=-1*x+diagonalX[1]+diagonalY[1] && y>=x-diagonalX[2]+diagonalY[2] && y>=-1*x+diagonalX[3]+diagonalY[3]) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import java.util.Map.Entry;

public class Main
{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
	private PrintWriter pw;
	private long mod = 1000000
			+ 3;

	private StringBuilder ans_sb;
	private int size = 1000005;

	private void soln()
	{
		int x1 = nextInt();
		int y1 = nextInt();
		int x2 = nextInt();
		int y2 = nextInt();
		int x3 = nextInt();
		int y3 = nextInt();
		int x4 = nextInt();
		int y4 = nextInt();

		int xx1 = nextInt();
		int yx1 = nextInt();
		int xx2 = nextInt();
		int yx2 = nextInt();
		int xx3 = nextInt();
		int yx3 = nextInt();
		int xx4 = nextInt();
		int yx4 = nextInt();

		Line l1 = new Line(
				(yx2 - yx1),
				(xx1 - xx2),
				yx1 * (xx2
						- xx1)
						- xx1 * (yx2
								- yx1));
		Line l2 = new Line(
				(yx3 - yx2),
				(xx2 - xx3),
				yx2 * (xx3
						- xx2)
						- xx2 * (yx3
								- yx2));
		Line l3 = new Line(
				(yx3 - yx4),
				(xx4 - xx3),
				yx4 * (xx3
						- xx4)
						- xx4 * (yx3
								- yx4));
		Line l4 = new Line(
				(yx4 - yx1),
				(xx1 - xx4),
				yx1 * (xx4
						- xx1)
						- xx1 * (yx4
								- yx1));

		Line ll1 = new Line(
				(y2 - y1),
				(x1 - x2),
				y1 * (x2 - x1)
						- x1 * (y2
								- y1));
		Line ll2 = new Line(
				(y3 - y2),
				(x2 - x3),
				y2 * (x3 - x2)
						- x2 * (y3
								- y2));
		Line ll3 = new Line(
				(y3 - y4),
				(x4 - x3),
				y4 * (x3 - x4)
						- x4 * (y3
								- y4));
		Line ll4 = new Line(
				(y4 - y1),
				(x1 - x4),
				y1 * (x4 - x1)
						- x1 * (y4
								- y1));

		boolean f = false;
		boolean f1 = false;
		boolean ff1 = true;
		boolean ff2 = true;
		f |= (find(
				l1,
				l3,
				x1,
				y1)
				& find(l2,
						l4,
						x1,
						y1));
		f |= (find(
				l1,
				l3,
				x2,
				y2)
				& find(l2,
						l4,
						x2,
						y2));
		f |= (find(
				l1,
				l3,
				x3,
				y3)
				& find(l2,
						l4,
						x3,
						y3));
		f |= (find(
				l1,
				l3,
				x4,
				y4)
				& find(l2,
						l4,
						x4,
						y4));

		ff1 &= (find1(
				l1,
				l3,
				x1,
				y1)
				& find1(l2,
						l4,
						x1,
						y1));
		ff1 &= (find1(
				l1,
				l3,
				x2,
				y2)
				& find1(l2,
						l4,
						x2,
						y2));
		ff1 &= (find1(
				l1,
				l3,
				x3,
				y3)
				& find1(l2,
						l4,
						x3,
						y3));
		ff1 &= (find1(
				l1,
				l3,
				x4,
				y4)
				& find1(l2,
						l4,
						x4,
						y4));
		// System.out.println(ll1.toString());
		// System.out.println(ll2.toString());
		// System.out.println(ll3.toString());
		// System.out.println(ll4.toString());
		f1 |= (find(
				ll1,
				ll3,
				xx1,
				yx1)
				& find(ll2,
						ll4,
						xx1,
						yx1));
		f1 |= (find(
				ll1,
				ll3,
				xx2,
				yx2)
				& find(ll2,
						ll4,
						xx2,
						yx2));
		f1 |= (find(
				ll1,
				ll3,
				xx3,
				yx3)
				& find(ll2,
						ll4,
						xx3,
						yx3));
		f1 |= (find(
				ll1,
				ll3,
				xx4,
				yx4)
				& find(ll2,
						ll4,
						xx4,
						yx4));

		ff2 &= (find1(
				ll1,
				ll3,
				xx1,
				yx1)
				& find1(ll2,
						ll4,
						xx1,
						yx1));
		ff2 &= (find1(
				ll1,
				ll3,
				xx2,
				yx2)
				& find1(ll2,
						ll4,
						xx2,
						yx2));
		ff2 &= (find1(
				ll1,
				ll3,
				xx3,
				yx3)
				& find1(ll2,
						ll4,
						xx3,
						yx3));
		ff2 &= (find1(
				ll1,
				ll3,
				xx4,
				yx4)
				& find1(ll2,
						ll4,
						xx4,
						yx4));
		// System.out.println(ll1.toString());
		if (f)
		{
			// if(!ff1)
			pw.println(
					"YES");
			// else
			// pw.println("NO");
		} else if (f1)
		{
			// if(!ff2)
			pw.println(
					"YES");
			// else
			// pw.println("NO");
		} else
		{
			pw.println(
					"NO");
		}

	}

	private class Line
	{
		int a, b,
				c;

		public Line(
				int x,
				int y,
				int z)
		{
			a = x;
			b = y;
			c = z;
			// if(a == 0 && b == 0) {
			//
			// }
		}

		public String toString()
		{
			return "["
					+ a
					+ " "
					+ b
					+ " "
					+ c
					+ "]";
		}
	}

	private boolean find(
			Line l1,
			Line l2,
			int x,
			int y)
	{
		boolean f = true;
		int v1 = l1.a
				* x
				+ l1.b * y
				+ l1.c;
		int v2 = l2.a
				* x
				+ l2.b * y
				+ l2.c;
		// debug(v1+" "+v2+" "+x+" "+y);
		if (v1 > 0
				&& v2 > 0)
			f = false;
		if (v1 < 0
				&& v2 < 0)
			f = false;
		return f;
	}

	private boolean find1(
			Line l1,
			Line l2,
			int x,
			int y)
	{
		boolean f = true;
		int v1 = l1.a
				* x
				+ l1.b * y
				+ l1.c;
		int v2 = l2.a
				* x
				+ l2.b * y
				+ l2.c;

		if (v1 >= 0
				&& v2 >= 0)
			f = false;
		if (v1 <= 0
				&& v2 <= 0)
			f = false;
		return f;
	}

	public class Pair
			implements
			Comparable<Pair>
	{
		int i, j,
				idx;

		public Pair(
				int a,
				int b,
				int c)
		{
			i = a;
			j = b;
			idx = c;
		}

		@Override
		public int compareTo(
				Pair o)
		{
			return this.i
					- o.i;
		}

		public String toString()
		{
			return "["
					+ i
					+ " "
					+ j
					+ "]";
		}
	}

	private int contains(
			int[] arr,
			int x)
	{
		for (int i = 0; i < arr.length; i++)
		{
			if (arr[i] == x)
			{
				return i;
			}
		}
		return -1;
	}

	private class Query
			implements
			Comparable<Query>
	{
		int i, idx,
				x,
				y,
				mul;

		public Query(
				int a,
				int b,
				int c,
				int d,
				int m)
		{
			i = a;
			idx = b;
			x = c;
			mul = m;
			y = d;
		}

		@Override
		public int compareTo(
				Query o)
		{
			return this.i
					- o.i;
		}
	}

	private long[][] pow(
			int a,
			int b,
			int n)
	{
		long[][] mat = {
				{ a, 0, b },
				{ 1L, 0, 0 },
				{ 0, 1L, 0 } };
		if (n == 1)
			return mat;
		long[][] res = pow(
				a,
				b,
				n / 2);
		res = multiply(
				res,
				res);
		if ((n & 1) != 0)
			res = multiply(
					mat,
					res);
		return res;
	}

	private long[][] multiply(
			long[][] a,
			long[][] b)
	{
		long[][] ret = new long[3][3];
		for (int i = 0; i < 3; i++)
			for (int j = 0; j < 3; j++)
				for (int k = 0; k < 3; k++)
					ret[i][j] = (ret[i][j]
							+ ((a[i][k]
									* b[k][j])
									% mod))
							% mod;
		return ret;
	}

	private class Node
	{
		Node left,
				right;
		int sum;

		public Node(
				int v)
		{
			sum = v;
		}

		public Node(
				Node left,
				Node right)
		{
			this.left = left;
			this.right = right;
			if (left != null)
				sum = sum
						+ left.sum;
			if (right != null)
				sum = sum
						+ right.sum;
		}
	}

	public Node build(
			int l,
			int r)
	{
		if (l == r)
			return new Node(
					0);
		int mid = l
				+ ((r - l) >> 1);
		Node left = build(
				l,
				mid);
		Node right = build(
				mid + 1,
				r);
		return new Node(
				left,
				right);
	}

	public int query(
			int l,
			int r,
			Node root)
	{
		return queryutil(
				l,
				r,
				root,
				0,
				size - 1);
	}

	public int queryutil(
			int x,
			int y,
			Node node,
			int l,
			int r)
	{
		if (l > y
				|| x > r)
			return 0;
		if (x <= l
				&& r <= y)
			return node.sum;
		int mid = l
				+ ((r - l) >> 1);
		return queryutil(
				x,
				y,
				node.left,
				l,
				mid)
				+ queryutil(
						x,
						y,
						node.right,
						mid + 1,
						r);
	}

	public Node newNode(
			int pos,
			int val,
			Node node)
	{
		return newNodeUtil(
				pos,
				val,
				node,
				0,
				size - 1);
	}

	public Node newNodeUtil(
			int pos,
			int val,
			Node node,
			int l,
			int r)
	{
		if (l == r)
			return new Node(
					val);
		int mid = l
				+ ((r - l) >> 1);
		if (pos <= mid)
		{
			Node left = newNodeUtil(
					pos,
					val,
					node.left,
					l,
					mid);
			return new Node(
					left,
					node.right);
		} else
		{
			Node right = newNodeUtil(
					pos,
					val,
					node.right,
					mid + 1,
					r);
			return new Node(
					node.left,
					right);
		}
	}

	private void debug(
			Object... o)
	{
		System.out
				.println(
						Arrays.deepToString(
								o));
	}

	private long pow(
			long a,
			long b,
			long c)
	{
		if (b == 0)
			return 1;
		long p = pow(
				a,
				b / 2,
				c);
		p = (p * p)
				% c;
		return (b
				% 2 == 0)
						? p
						: (a * p)
								% c;
	}

	private long gcd(
			long n,
			long l)
	{
		if (l == 0)
			return n;
		return gcd(
				l,
				n % l);
	}

	public static void main(
			String[] args)
			throws Exception
	{
		new Thread(
				null,
				new Runnable()
				{
					@Override
					public void run()
					{
						new Main()
								.solve();
					}
				},
				"1",
				1 << 26).start();
		// new Main().solve();
	}

	public StringBuilder solve()
	{
		InputReader(
				System.in);
		/*
		 * try { InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\in.txt"));
		 * } catch(FileNotFoundException e) {}
		 */
		pw = new PrintWriter(
				System.out);
		// ans_sb = new StringBuilder();
		soln();

		pw.close();
		// System.out.println(ans_sb);
		return ans_sb;
	}

	public void InputReader(
			InputStream stream1)
	{
		stream = stream1;
	}

	private boolean isWhitespace(
			int c)
	{
		return c == ' '
				|| c == '\n'
				|| c == '\r'
				|| c == '\t'
				|| c == -1;
	}

	private boolean isEndOfLine(
			int c)
	{
		return c == '\n'
				|| c == '\r'
				|| c == -1;
	}

	private int read()
	{
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars)
		{
			curChar = 0;
			try
			{
				numChars = stream
						.read(buf);
			} catch (IOException e)
			{
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	private int nextInt()
	{
		int c = read();
		while (isSpaceChar(
				c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		int res = 0;
		do
		{
			if (c < '0'
					|| c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(
				c));
		return res
				* sgn;
	}

	private long nextLong()
	{
		int c = read();
		while (isSpaceChar(
				c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		long res = 0;
		do
		{
			if (c < '0'
					|| c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(
				c));
		return res
				* sgn;
	}

	private String nextToken()
	{
		int c = read();
		while (isSpaceChar(
				c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(
					c);
			c = read();
		} while (!isSpaceChar(
				c));
		return res
				.toString();
	}

	private String nextLine()
	{
		int c = read();
		while (isSpaceChar(
				c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(
					c);
			c = read();
		} while (!isEndOfLine(
				c));
		return res
				.toString();
	}

	private int[] nextIntArray(
			int n)
	{
		int[] arr = new int[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextInt();
		}
		return arr;
	}

	private long[] nextLongArray(
			int n)
	{
		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextLong();
		}
		return arr;
	}

	private void pArray(
			int[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out
					.print(arr[i]
							+ " ");
		}
		System.out
				.println();
		return;
	}

	private void pArray(
			long[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out
					.print(arr[i]
							+ " ");
		}
		System.out
				.println();
		return;
	}

	private boolean isSpaceChar(
			int c)
	{
		if (filter != null)
			return filter
					.isSpaceChar(
							c);
		return isWhitespace(
				c);
	}

	private char nextChar()
	{
		int c = read();
		while (isSpaceChar(
				c))
			c = read();
		char c1 = (char) c;
		while (!isSpaceChar(
				c))
			c = read();
		return c1;
	}

	private interface SpaceCharFilter
	{
		public boolean isSpaceChar(
				int ch);
	}
}

import java.util.*;

public final class ProblemC {

    public static class Point {
        int x;
        int y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public String toString() {
            return String.format("(%d, %d)", this.x, this.y);
        }
    }

    public static boolean isContained(Point[] sq1, Point[] sq2) {
        for (Point p : sq2) {
            if (p.x < sq1[0].x || p.x > sq1[2].x
                    || p.y < sq1[0].y || p.y > sq1[3].y) {
                continue;
            } else {
                return true;
            }
        }
        return false;
    }

    public static void transform(Point[] ps) {
        for (Point p : ps) {
            int x = p.x;
            int y = p.y;
            p.x = x - y;
            p.y = x + y;
        }
    }

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        Point[] pa = new Point[4];
        pa[0] = new Point(s.nextInt(), s.nextInt());
        pa[1] = new Point(s.nextInt(), s.nextInt());
        pa[2] = new Point(s.nextInt(), s.nextInt());
        pa[3] = new Point(s.nextInt(), s.nextInt());

        Arrays.sort(pa, new Comparator<Point>() {
            @Override
            public int compare(Point p1, Point p2) {
                if (p1.x != p2.x) {
                    return p1.x - p2.x;
                }
                return p1.y - p2.y;
            }
        });

        Point[] pb = new Point[4];
        pb[0] = new Point(s.nextInt(), s.nextInt());
        pb[1] = new Point(s.nextInt(), s.nextInt());
        pb[2] = new Point(s.nextInt(), s.nextInt());
        pb[3] = new Point(s.nextInt(), s.nextInt());

        if (isContained(pa, pb)) {
            System.out.println("Yes");
            return;
        }

        transform(pa);
        transform(pb);

        Arrays.sort(pb, new Comparator<Point>() {
            @Override
            public int compare(Point p1, Point p2) {
                if (p1.x != p2.x) {
                    return p1.x - p2.x;
                }
                return p1.y - p2.y;
            }
        });

        //System.out.println(Arrays.toString(pa));
        //System.out.println(Arrays.toString(pb));

        if (isContained(pb, pa)) {
            System.out.println("Yes");
            return;
        }

        System.out.println("No");
    }

}

import java.util.*;
import java.awt.*;

public class Main {

    static final double eps = 1e-6;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x1[] = new int[4];
        int y1[] = new int[4];
        int x2[] = new int[4];
        int y2[] = new int[4];

        for( int i=0; i<4; i++ ) {
                x2[i] = sc.nextInt();
                y2[i] = sc.nextInt();
        }

        for( int i=0; i<4; i++ ) {
                x1[i] = sc.nextInt();
                y1[i] = sc.nextInt();
        }

        Polygon P = new Polygon( x1, y1, 4 );

        double x, y;
        double w, h;

        x = x2[0];
        y = y2[0];

        double xx = x2[0] - x2[1];

        double yy = y2[0] - y2[1];

        w = Math.sqrt( xx * xx + yy * yy );

        h = Math.sqrt( xx * xx + yy * yy );

        w += eps;

        h += eps;

        if( P.intersects( x, y, w, h ) ) {
                System.out.println( "YES" );
        }
        else {
                System.out.println( "NO" );
        }
    }
}

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

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

	FastReader in = new FastReader();
	PrintWriter out = new PrintWriter(System.out);
	void run(){
		work();
		out.flush();
	}
	long mod=998244353;
	long gcd(long a,long b) {
		return b==0?a:gcd(b,a%b);
	}
	void work() {
		int[] A=new int[] {99999999,-1,99999999,-1};//x1,x2,y1,y2
		int[] B=new int[] {99999999,-1,-1,99999999};//l,u,r,d
		int[][] P1=new int[4][];
		int[][] P2=new int[4][];
		for(int i=0;i<4;i++) {
			int x=in.nextInt();
			int y=in.nextInt();
			P1[i]=new int[] {x,y};
			A[0]=Math.min(A[0], x);
			A[1]=Math.max(A[1], x);
			A[2]=Math.min(A[2], y);
			A[3]=Math.max(A[3], y);
		}
		for(int i=0;i<4;i++) {
			int x=in.nextInt();
			int y=in.nextInt();
			P2[i]=new int[] {x,y};
			B[0]=Math.min(B[0], x);
			B[1]=Math.max(B[1], y);
			B[2]=Math.max(B[2], x);
			B[3]=Math.min(B[3], y);
		}
		//不想交
		if(B[0]>A[1]||B[1]<A[2]||B[2]<A[0]||B[3]>A[3]) {
			out.println("NO");
			return;
		}
		//某点在正方形中
		if(check(A,P2[0])||check(A,P2[1])||check(A,P2[2])||check(A,P2[3])) {
			out.println("YES");
			return;
		}
		//某点在菱形中
		if(check3((A[0]+A[1])/2,(A[2]+A[3])/2,P2)) {
			out.println("YES");
			return;
		}
		//边相交
		if(check2(P1,P2[0],P2[1])||check2(P1,P2[0],P2[3])||check2(P1,P2[1],P2[2])||check2(P1,P2[2],P2[3])) {
			out.println("YES");
			return;
		}
		out.println("NO");
	}
	private boolean check3(int x,int y,int[][] A) {
		if(check4(x,y,A[0],A[1])!=check4(x,y,A[2],A[3])&&check4(x,y,A[0],A[3])!=check4(x,y,A[1],A[2])) {
			return true;
		}
		return false;
	}
	private boolean check4(int x, int y, int[] P1, int[] P2) {
		return P1[1]-(P1[0]-x)*(P1[1]-P2[1])/(P1[0]-P2[0])>y;
	}
	private boolean check2(int[][] P, int[] P1, int[] P2) {
		int[] count=new int[2];
		for(int i=0;i<4;i++) {
			int x=P[i][0];
			int y=P[i][1];
			int ny=P1[1]-(P1[0]-x)*(P1[1]-P2[1])/(P1[0]-P2[0]);
			if(ny==y)return true;
			if(ny>y)count[0]++;
			else {
				count[1]++;
			}
		}
		return count[0]>0&&count[1]>0;
	}
	private boolean check(int[] A, int[] P) {
		if(A[0]<=P[0]&&A[1]>=P[0]&&A[2]<=P[1]&&A[3]>=P[1]) {
			return true;
		}
		return false;
	}
}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

	public FastReader()
	{
		br=new BufferedReader(new InputStreamReader(System.in));
	}

	public String next()
	{
		if(st==null || !st.hasMoreElements())
		{
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	public int nextInt()
	{
		return Integer.parseInt(next());
	}

	public long nextLong()
	{
		return Long.parseLong(next());
	}
}

import java.util.Scanner;

public class Squares {
    public static void main(String... args) {
        //init
        Scanner scanner = new Scanner(System.in);
        Point[] points1 = new Point[4];
        for (int i = 0; i < 4; i++) {
            points1[i] = new Point(scanner.nextInt(), scanner.nextInt());
        }
        Square square = new Square(points1);
        Point[] points2 = new Point[4];
        for (int i = 0; i < 4; i++) {
            points2[i] = new Point(scanner.nextInt(), scanner.nextInt());
        }

        float x = 0;
        float y = 0;
        for (Point p : points2) {
            x += p.x;
            y += p.y;
            if (square.left <= p.x && square.right >= p.x &&
                    square.top >= p.y && square.bottom <= p.y) {
                System.out.print("YES");
                return;
            }
        }

        x /= 4;
        y /= 4;//center of second square

        double min = Double.MAX_VALUE;
        for (int i = 0; i < 4; i++) {
            points1[i] = rotatePoint(points1[i], x, y);
            points2[i] = rotatePoint(points2[i], x, y);
        }
        Square rotatedSquare = new Square(points2);
        for (Point p : points1) {
            if (rotatedSquare.left <= p.x && rotatedSquare.right >= p.x &&
                    rotatedSquare.top >= p.y && rotatedSquare.bottom <= p.y) {
                System.out.print("YES");
                return;
            }
        }
        System.out.print("NO");
    }

    private static Point rotatePoint(Point point, double x, double y) {
        double temp = Math.sqrt(2)/2;
        double newX = point.x - x;
        double newY = point.y - y;
        newX = (newX * temp - newY*temp);
        newY = (newY*temp + newX*temp);
        newX += x;
        newY += y;
        return new Point(newX, newY);
    }

    private static class Point {
        double x;
        double y;
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
        public Point(double x, double y) {
            this.x = x;
            this.y = y;
        }
    }

    private static class Square {
        Point[] points;
        double left;
        double right;
        double bottom;
        double top;
        Square(Point[] points) {
            this.points = points;
            left = points[0].x;
            right = points[0].x;
            bottom = points[0].y;
            top = points[0].y;
            for (Point p : points) {
                if (p.x < left) {
                    left = p.x;
                }
                if (p.x > right) {
                    right = p.x;
                }
                if (p.y < bottom) {
                    bottom = p.y;
                }
                if (p.y > top) {
                    top = p.y;
                }
            }
        }
    }

}

import java.io.*;
import java.math.*;
import java.util.*;
public class Main
{
    static int mod=((int)1e9)+7;//toString
    public static int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}
    public static int pow_mod(int n,int x){if(x==0)return 1;else{if((x&1)==0){return (pow_mod((((n%mod)*(n%mod))%mod),(x/2)));}else{return (((n%mod)*(pow_mod((((n%mod)*(n%mod))%mod),((x-1)/2))%mod)));}}}
    public static int lower_bound(int[]arr,int val){int lo=0;int hi=arr.length-1;while(lo<hi){int mid=lo+((hi-lo+1)/2);if(arr[mid]==val){return mid;}else if(arr[mid]>val){hi=mid-1;}else lo=mid;}if(arr[lo]<=val)return lo;else return -1;}
    public static int upper_bound(int[]arr,int val){int lo=0;int hi=arr.length-1;while(lo<hi){int mid=lo+((hi-lo)/2);if(arr[mid]==val){return mid;}else if(arr[mid]>val){hi=mid;;}else lo=mid+1;}if(arr[lo]>=val)return lo;else return -1;}

    public static int area(int[]a,int[]b,int[]c)
    {
        int ans=(a[0]*(b[1]-c[1]))+(b[0]*(c[1]-a[1]))+(c[0]*(a[1]-b[1]));
        if(ans<0)
        ans*=-1;
        return (ans>>1);
    }

    public static void main (String[] args) throws java.lang.Exception
    {
        Reader sn=new Reader();
        Print p=new Print();
        int[][]first=new int[2][4];
        int[][]second=new int[2][4];
        for(int i=0;i<8;++i){
            first[(i&1)][(i>>1)]=sn.nextInt();
        }
        for(int i=0;i<8;++i){
            second[(i&1)][(i>>1)]=sn.nextInt();
        }
        int flag=0;
        int area_first=((first[0][0]-first[0][1])*(first[0][0]-first[0][1]))+((first[1][0]-first[1][1])*(first[1][0]-first[1][1]));
        int area_second=((second[0][0]-second[0][1])*(second[0][0]-second[0][1]))+((second[1][0]-second[1][1])*(second[1][0]-second[1][1]));
        for(int i=(-100);i<101;++i){
            for(int j=(-100);j<101;++j){
                int from_first=0;
                int[]c={i,j};
                int[]a1={first[0][0],first[1][0]};
                int[]b1={first[0][1],first[1][1]};
                from_first+=(area(a1,b1,c));
                int[]a2={first[0][1],first[1][1]};
                int[]b2={first[0][2],first[1][2]};
                from_first+=(area(a2,b2,c));
                int[]a3={first[0][2],first[1][2]};
                int[]b3={first[0][3],first[1][3]};
                from_first+=(area(a3,b3,c));
                int[]a4={first[0][3],first[1][3]};
                int[]b4={first[0][0],first[1][0]};
                from_first+=(area(a4,b4,c));
                int from_second=0;
                int[]aa1={second[0][0],second[1][0]};
                int[]bb1={second[0][1],second[1][1]};
                from_second+=(area(aa1,bb1,c));
                int[]aa2={second[0][1],second[1][1]};
                int[]bb2={second[0][2],second[1][2]};
                from_second+=(area(aa2,bb2,c));
                int[]aa3={second[0][2],second[1][2]};
                int[]bb3={second[0][3],second[1][3]};
                from_second+=(area(aa3,bb3,c));
                int[]aa4={second[0][3],second[1][3]};
                int[]bb4={second[0][0],second[1][0]};
                from_second+=(area(aa4,bb4,c));
                if((from_first==area_first) && (from_second==area_second))
                flag=1;
            }
        }
        if(flag==1)
        p.printLine("YES");
        else
        p.printLine("NO");
        p.close();
    }
}
class Pair implements Comparable<Pair> {
		int val;
		int in;
		Pair(int a, int b){
			val=a;
	        in=b;
		}
		@Override
		public int compareTo(Pair o) {
			if(val==o.val)
			return Integer.compare(in,o.in);
			else
			return Integer.compare(val,o.val);
		}}
class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public String readWord()throws IOException
        {
		int c = read();
		while (isSpaceChar(c)) c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		}while (!isSpaceChar(c));
		return res.toString();
	    }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
class Print
{
    private final BufferedWriter bw;
    public Print()
    {
        bw=new BufferedWriter(new OutputStreamWriter(System.out));
    }
    public void print(String str)throws IOException
    {
        bw.append(str);
    }
    public void printLine(String str)throws IOException
    {
        print(str);
        bw.append("\n");
    }
    public void close()throws IOException
    {
        bw.close();
    }}

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C
{

		public static void main(String[] args) throws IOException
		{
			Scanner sc=new Scanner(System.in);
			PrintWriter pw=new PrintWriter(System.out);
			int n=8;
			int []p1=new int [8];
			int []p2=new int [n];
			int minX=200;
			int maxX=-200;
			int minY=200;
			int maxY=-200;
			for(int i=0;i<n;i++)
			{
				p1[i]=sc.nextInt();
				if(i%2==0)
				{
					minX=Math.min(minX, p1[i]);
					maxX=Math.max(maxX, p1[i]);
				}
				else
				{
					minY=Math.min(minY, p1[i]);
					maxY=Math.max(maxY, p1[i]);
				}

			}

			for(int i=0;i<n;i++)
				p2[i]=sc.nextInt();
			lineSegment[]a1=new lineSegment[4];
			lineSegment[]a2=new lineSegment[4];
			for(int i=0,c=0;i+3<n;i+=2,c++)
				a1[c]=new lineSegment(p1[i],p1[i+1],p1[i+2],p1[i+3]);
			a1[3]=new lineSegment(p1[6],p1[7],p1[0],p1[1]);
			for(int i=0,c=0;i+3<n;i+=2,c++)
				a2[c]=new lineSegment(p2[i],p2[i+1],p2[i+2],p2[i+3]);
			a2[3]=new lineSegment(p2[6],p2[7],p2[0],p2[1]);

			boolean intersecting=false;
			for(int i=0;i<4;i++)
				for(int j=0;j<4;j++)
					intersecting|=(a1[i].isIntersecting(a2[j]));
			boolean inside=false;
			for(int i=0;i<n;i+=2)
			{
				int x=p2[i];
				int y=p2[i+1];
				if(x>=minX && x<=maxX && y>=minY && y<=maxY)
					inside=true;

			}
			pw.println(intersecting||inside?"YES":"NO");
			pw.close();

		}

		static class lineSegment
		{

			point p1;
			point p2;

			public static int direction(point p,point q,point r)
			{
				point a=new point ((q.x-p.x),(q.y-p.y));
				point b=new point ((r.x-p.x),(r.y-p.y));
				return cross(b,a);
			}
			public static int cross(point p,point q)
			{
				return p.x*q.y-q.x*p.y;
			}

			public lineSegment(int x1,int y1,int x2,int y2)

			{

				p1=new point(x1,y1);p2=new point(x2,y2);
			}
			public boolean isIntersecting(lineSegment l)
			{
				int d1=direction(this.p1,this.p2,l.p1);
				int d2=direction(this.p1,this.p2,l.p2);
				int d3=direction(l.p1,l.p2,this.p1);
				int d4=direction(l.p1,l.p2,this.p2);
				if(isstraddle(d1,d2) && isstraddle(d3,d4))
					return true;
				if(d1==0 && isOnSegment(this,l.p1))
					return true;
				if(d2==0 && isOnSegment(this,l.p2))
					return true;
				if(d3==0 && isOnSegment(l,this.p1))
					return true;
				if(d4==0 && isOnSegment(l,this.p2))
					return true;
				return false;

			}
			public static boolean isOnSegment (lineSegment l,point p)
			{
				if(p.x<=Math.max(l.p1.x, l.p2.x) &&p.x>=Math.min(l.p1.x, l.p2.x) &&p.y<=Math.max(l.p1.y, l.p2.y) &&p.y>=Math.min(l.p1.y, l.p2.y))
					return true;
				return false;
			}
			public boolean isstraddle(int d1,int d2)
			{
				if(d1<0 && d2>0)
					return true;
				if(d1>0 && d2<0)
					return true;
				return false;
			}
			public String toString()
			{
				return p1+" "+p2;
			}

		}
		static class point
		{

			int x;
			int  y;
			public point (int a,int  b)
			{
				x=a;
				y=b;
			}
			public String toString()
			{
				return x+" "+y;
			}

		}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.util.stream.IntStream;

public class C {

    int[] x1,y1,x2,y2;

    private boolean intersect(int[] a,int[] b,int[] c,int[] d) {

        // 座標軸に平行な正方形の座標
        int minX1 = Arrays.stream(a).min().getAsInt();
        int maxX1 = Arrays.stream(a).max().getAsInt();
        int minY1 = Arrays.stream(b).min().getAsInt();
        int maxY1 = Arrays.stream(b).min().getAsInt();

        // 座標軸に対して45度回転している正方形の座標
        int minX2 = Arrays.stream(c).min().getAsInt();
        int maxX2 = Arrays.stream(c).min().getAsInt();
        int minY2 = Arrays.stream(d).min().getAsInt();
        int maxY2 = Arrays.stream(d).min().getAsInt();

        // x座標について境界チェック
        if ((minX1 <= minX2 && minX2 <= maxX1) ||
                (minX1 <= maxX2 && maxX2 <= maxX1)) {
            return true;
        }

        // y座標について境界チェック
        if ((minY1 <= minY2 && minY2 <= maxY1) ||
                (minY1 <= maxY2 && maxY2 <= maxY1)) {
            return true;
        }
        return false;
    }

    private void rotate(int[] x,int[] y) {
        for(int i = 0;i < 4;i++) {
            int tmpX = x[i] + y[i];
            int tmpY = x[i] - y[i];
            x[i] = tmpX;
            y[i] = tmpY;
        }
    }

    private void solve() {
        x1 = new int[4];
        y1 = new int[4];
        for(int i = 0;i < 4;i++) {
            x1[i] = nextInt();
            y1[i] = nextInt();
        }

        x2 = new int[4];
        y2 = new int[4];
        for(int i = 0;i < 4;i++) {
            x2[i] = nextInt();
            y2[i] = nextInt();
        }

        if (intersect(x1, y1, x2, y2)) {
            out.println("YES");
            return;
        }

        rotate(x1, y1);
        rotate(x2, y2);

        if (intersect(x2, y2, x1, y1)) {
            out.println("YES");
            return ;
        }

        out.println("NO");
    }

    public static void main(String[] args) {
        out.flush();
        new C().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

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

public class Main {

    void solve() {
        long x1[]=new long[4];
        long y1[]=new long[4];
        long x2[]=new long[4];
        long y2[]=new long[4];

        for(int i=0;i<4;i++){
            x1[i]=nl(); y1[i]=nl();
        }
        for(int i=0;i<4;i++){
            x2[i]=nl(); y2[i]=nl();
        }
        for(int i=0;i<4;i++){
            if(check(x1,y1,x2[i],y2[i])){
                pw.println("YES");
                return;
            }
        }
        long xx=-1,yy=-1;
        if(x1[0]==x1[3]) xx=x1[0];
        else xx=x1[1];
        if(y1[0]==y1[3]) yy=y1[0];
        else yy=y1[2];
        if(check(x1,y1,xx,yy)){
            pw.println("YES");
            return;
        }
        long x0=x2[0],y0=y2[0];
        for(int i=0;i<4;i++){
            x2[i]-=x0; y2[i]-=y0;
             xx=x2[i];yy=y2[i];
            x2[i]=(xx+yy);
            y2[i]=(-xx+yy);
        }

        for(int i=0;i<4;i++){
            x1[i]-=x0; y1[i]-=y0;
             xx=x1[i];yy=y1[i];
            x1[i]=(xx+yy);
            y1[i]=(-xx+yy);
            if(check(x2,y2,x1[i],y1[i])){
                pw.println("YES");
                return;
            }
        }
        if(x2[0]==x2[3]) xx=x2[0];
        else xx=x2[1];
        if(y2[0]==y2[3]) yy=y2[0];
        else yy=y2[1];
        if(check(x2,y2,xx,yy)){
            pw.println("YES");
            return;
        }
        pw.println("NO");

    }
    boolean check(long x1[],long y1[],long x0,long y0){

        long mnx=Math.min(x1[0],Math.min(x1[1],x1[2])),mxx=Math.max(x1[0],Math.max(x1[1],x1[2]));
        long mny=Math.min(y1[0],Math.min(y1[1],y1[2])),mxy=Math.max(y1[0],Math.max(y1[1],y1[2]));

        return mnx<=x0 && x0<=mxx && mny<=y0 && y0<=mxy;

    }

    long M=(long)1e9+7;
    InputStream is;
    PrintWriter pw;
    String INPUT = "";
    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        pw = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        pw.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

    public static void main(String[] args) throws Exception { new Main().run(); }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by Arihant Jain on 6/16/2018.
 */
public class twoSquares {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String out[] = br.readLine().split(" ");
        int parallelX[] = new int[4];
        int parallelY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            parallelX[i/2] = Integer.parseInt(out[i]);
            parallelY[i/2] = Integer.parseInt(out[i+1]);
        }
        int x1 = Math.min(parallelX[0],parallelX[2]);
        int x2 = Math.max(parallelX[0], parallelX[2]);
        int y1 = Math.min(parallelY[0],parallelY[2]);
        int y2 = Math.max(parallelY[0], parallelY[2]);
        out = br.readLine().split(" ");
        int diagonalGivenX[] = new int[4];
        int diagonalGivenY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            diagonalGivenX[i/2] = Integer.parseInt(out[i])+100;
            diagonalGivenY[i/2] = Integer.parseInt(out[i+1])+100;
        }
        int xMin = 0;
        int xMax = 0;
        int yMin = 0;
        int yMax = 0;
        for (int i =1; i<4; i++) {
            if (diagonalGivenX[i]<diagonalGivenX[xMin])
                xMin = i;
            if (diagonalGivenX[i]>diagonalGivenX[xMax])
                xMax = i;
            if (diagonalGivenY[i]<diagonalGivenY[yMin])
                yMin = i;
            if (diagonalGivenY[i]>diagonalGivenY[yMax])
                yMax = i;
        }
        int[] diagonalX = new int[4];
        int[] diagonalY = new int[4];
        diagonalX[0] = diagonalGivenX[xMin];
        diagonalX[1] = diagonalGivenX[yMax];
        diagonalX[2] = diagonalGivenX[xMax];
        diagonalX[3] = diagonalGivenX[yMin];
        diagonalY[0] = diagonalGivenY[xMin];
        diagonalY[1] = diagonalGivenY[yMax];
        diagonalY[2] = diagonalGivenY[xMax];
        diagonalY[3] = diagonalGivenY[yMin];
        for (int i =0; i<4; i++) {
            if (diagonalX[i]>=x1 && diagonalX[i]<= x2 && diagonalY[i]>=y1 && diagonalY[i]<=y2) {
                System.out.println("YES");
                return;
            }
        }
        for (int i =0; i<4; i++) {
            int x = parallelX[i];
            int y = parallelY[i];
            if (y<=x+diagonalY[0]-diagonalX[0] && y<=-1*x+diagonalX[1]+diagonalY[1] && y>=x-diagonalX[2]+diagonalY[2] && y>=-1*x+diagonalX[3]+diagonalY[3]) {
                System.out.println("YES");
                return;
            }
        }

        System.out.println("NO");
    }
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Main
{
    static long mod=1000000007;
    public static void main(String[] args) throws Exception
    {
    	FastReader in=new FastReader();
    	PrintWriter pw=new PrintWriter(System.out);
    	int axmax=-101,axmin=101,aymax=-101,aymin=101;
    	int bxmax=-101,bxmin=101,bymax=-101,bymin=101;
    	int[][] a=new int[4][2];
    	int[][] b=new int[4][2];
    	for(int i=0;i<4;i++)
    	{
    		for(int j=0;j<2;j++)
    		{
	    		if(j==0)
	    		{
	    			a[i][j]=in.nextInt();
	    			axmin=Math.min(axmin,a[i][j]);
	    			axmax=Math.max(axmax,a[i][j]);
	    		}
	    		else
	    		{
	    			a[i][j]=in.nextInt();
	    			aymin=Math.min(aymin,a[i][j]);
	    			aymax=Math.max(aymax,a[i][j]);
	    		}
    		}
    	}
    	for(int i=0;i<4;i++)
    	{
    		for(int j=0;j<2;j++)
    		{
	    		if(j==0)
	    		{
	    			b[i][j]=in.nextInt();
	    			bxmin=Math.min(bxmin,b[i][j]);
	    			bxmax=Math.max(bxmax,b[i][j]);
	    		}
	    		else
	    		{
	    			b[i][j]=in.nextInt();
	    			bymin=Math.min(bymin,b[i][j]);
	    			bymax=Math.max(bymax,b[i][j]);
	    		}
    		}
    	}
    	String ans="NO";
    	for(int i=0;i<4;i++)
    	{
    		if(axmin<=b[i][0] && b[i][0]<=axmax && aymin<=b[i][1] && b[i][1]<=aymax)
    			ans="YES";
    		else if(bxmin<=a[i][0] && a[i][0]<=bxmax && bymin<=a[i][1] && a[i][1]<=bymax)
    			ans="YES";
    	}
    	pw.print(ans);
    	pw.flush();
    }

    public static long inverse(long a)
    {
    	long r=1,p=mod-2;
    	while(p>0)
    	{
    		if(p%2==1)
    		{
    			r*=a;
    			r%=mod;
    		}
    		p>>=1;
    		a=(a*a)%mod;
    	}

    	return r;
    }

}

class pair<A,B>
{
    A f;
    B s;

    public pair(A a,B b)
    {
        f=a;
        s=b;
    }
}

class FastReader
{
    BufferedReader br;
    StringTokenizer st;

    public FastReader()
    {
        br=new BufferedReader(new InputStreamReader(System.in));
    }

    public String next() throws IOException
    {
        if(st==null || !st.hasMoreElements())
        {
            st=new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

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

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

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

public class Sol {
 static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
		FastReader sc=new FastReader();
		point[] sq1 =new point[4];
		point[] sq2 =new point[4];
		point x_min;point y_min;point x_max;point y_max;
		int minx=999;int maxx=-999;int miny=999;int maxy=-999;
		for(int i=0;i<4;i++){
			int x=sc.nextInt();
			int y=sc.nextInt();
			minx=Math.min(minx,x);
			maxx=Math.max(maxx,x);
			miny=Math.min(miny,x);
			maxy=Math.max(maxy,x);
//			miny=
			sq1[i]=new point(x,y);
		}
		for(int i=0;i<4;i++){
			int x=sc.nextInt();
			int y=sc.nextInt();
			sq2[i]=new point(x,y);
		}
		x_min=findxmin(sq2);
		x_max=findxmax(sq2);
		y_min=findymin(sq2);
		y_max=findymax(sq2);
		boolean is_in=false;
		if((maxx+maxy-y_min.y-y_min.x)*(minx+miny-y_min.y-y_min.x)<=0)
			is_in=true;
		if((maxx+maxy-y_max.y-y_max.x)*(minx+miny-y_max.y-y_max.x)<=0)
			is_in=true;
		if(x_min.x>maxx||x_max.x<minx||y_min.y>maxy||y_max.y<miny)
			is_in=false;

		if(is_in)
			System.out.println("YES");
		else
			System.out.println("NO");
    }
	static point findxmin(point[] sq){
		int x=999;
		int ind=-1;
		for(int i=0;i<4;i++){
			if(x>sq[i].x){
				ind=i;
				x=sq[i].x;}
		}
		return sq[ind];
	}
	static point findxmax(point[] sq){
		int x=-999;
		int ind=-1;
		for(int i=0;i<4;i++){
			if(x<sq[i].x){
				ind=i;
				x=sq[i].x;}
		}
		return sq[ind];
	}
	static point findymin(point[] sq){
		int y=999;
		int ind=-1;
		for(int i=0;i<4;i++){
			if(y>sq[i].y){
				ind=i;
				y=sq[i].y;}
		}
		return sq[ind];
	}
	static point findymax(point[] sq){
		int y=-999;
		int ind=-1;
		for(int i=0;i<4;i++){
			if(y<sq[i].y){
				ind=i;
				y=sq[i].y;}
		}
		return sq[ind];
	}

	static class point{
		int x;
		int y;
		point(int x,int y){
			this.x=x;
			this.y=y;
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeSet;

/*
....x.xxxxx.xxxxx.x...x.xxxxx.xxxxx.xxxxx.......xxxxx.xxxxx.xxxxx
....x.....x.....x.x...x.x.....x.........x...x...x...x.x...x.x...x
....x.....x.....x.x...x.x.....x.........x...x...x...x.x...x.x...x
....x.xxxxx.xxxxx.xxxxx.xxxxx.xxxxx.....x.xxxxx.xxxxx.xxxxx.x...x
....x.x.........x.....x.....x.x...x.....x...x...x...x.....x.x...x
....x.x.........x.....x.....x.x...x.....x...x...x...x.....x.x...x
....x.xxxxx.xxxxx.....x.xxxxx.xxxxx.....x.......xxxxx.xxxxx.xxxxx
 */
/**
 *
 * @author Andy Phan
 */
public class a {

    public static void main(String[] args) {
        FS in = new FS(System.in);
        PrintWriter out = new PrintWriter(System.out);

        VecL[] a = new VecL[4];
        for(int i = 0; i < 4; i++) a[i] = new VecL(in.nextInt(), in.nextInt());
        VecL[] b = new VecL[4];
        for(int i = 0; i < 4; i++) b[i] = new VecL(in.nextInt(), in.nextInt());

        for(int i = 0; i < 4; i++) {
            int[] num = new int[3];
            SegL t1 = new SegL(b[i], b[(i+1)%4]);
            for(int j = 0; j < 4; j++) {
                SegL t2 = new SegL(a[j], a[(j+1)%4]);
                if(t1.intersects(t2)) {
                    System.out.println("YES");
                    return;
                }
                num[(int)t2.side(b[i])+1]++;
            }
            if(Math.max(num[0], num[2]) == 4) {
                System.out.println("YES");
                return;
            }
        }
        VecL[] tmp = a;
        a = b;
        b = a;
        for(int i = 0; i < 4; i++) {
            int[] num = new int[3];
            SegL t1 = new SegL(b[i], b[(i+1)%4]);
            for(int j = 0; j < 4; j++) {
                SegL t2 = new SegL(a[j], a[(j+1)%4]);
                if(t1.intersects(t2)) {
                    System.out.println("YES");
                    return;
                }
                num[(int)t2.side(b[i])+1]++;
            }
            if(Math.max(num[0], num[2]) == 4) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
        out.close();
    }

    static class VecL implements Comparable<VecL> {

        long x, y;

        public VecL(long x, long y) {
            this.x = x;
            this.y = y;
        }

        public VecL add(VecL o) {
            return new VecL(x + o.x, y + o.y);
        }

        public VecL sub(VecL o) {
            return new VecL(x - o.x, y - o.y);
        }

        public VecL scale(long s) {
            return new VecL(x * s, y * s);
        }

        public long dot(VecL o) {
            return x * o.x + y * o.y;
        }

        public long cross(VecL o) {
            return x * o.y - y * o.x;
        }

        public long mag2() {
            return dot(this);
        }

        public VecL rot90() {
            return new VecL(-y, x);
        }

        public VecL rot270() {
            return new VecL(y, -x);
        }

        public String toString() {
            return "(" + x + ", " + y + ")";
        }

        public int hashCode() {
            return Long.hashCode(x << 13 ^ (y * 57));
        }

        public boolean equals(Object oo) {
            VecL o = (VecL) oo;
            return x == o.x && y == o.y;
        }

        public int compareTo(VecL o) {
            if (x != o.x) {
                return Long.compare(x, o.x);
            }
            return Long.compare(y, o.y);
        }

        //origin->q1, axes-> quadrant in ccw direction
        public int quadrant() {
            if (x == 0 || y == 0) {
                if (y == 0) {
                    if (x >= 0) {
                        return 1;
                    } else {
                        return 3;
                    }
                } else if (y >= 0) {
                    return 2;
                } else {
                    return 4;
                }
            }
            if (x > 0) {
                if (y > 0) {
                    return 1;
                } else {
                    return 4;
                }
            } else if (y > 0) {
                return 2;
            } else {
                return 3;
            }
        }

        public int radialCompare(VecL o) {
            if (quadrant() == o.quadrant()) {
                return -Long.signum(cross(o));
            }
            return Integer.compare(quadrant(), o.quadrant());
        }
    }

    static class SegL {

        VecL from, to, dir;

        public SegL(VecL from, VecL to) {
            this.from = from;
            this.to = to;
            dir = to.sub(from);
        }

        //check if the segment contains the point
        public boolean contains(VecL p) {
            VecL d = p.sub(from);
            if (d.cross(dir) != 0) {
                return false;
            }
            long dot = d.dot(dir);
            return dot >= 0 && dot <= dir.mag2();
        }

        //(assuming I go left to right)
        //returns:
        //	1 if point is above me
        //	0 if point is on me
        //	-1 if point is below me
        public long side(VecL o) {
            long cross = dir.cross(o.sub(from));
            return cross == 0 ? 0 : cross / Math.abs(cross);
        }

        //returns true if this segl intersects the other, including at endpoints
        //note: returns false if the two segments lie on the same line
        public boolean intersects(SegL o) {
            return side(o.from) != side(o.to) && o.side(from) != o.side(to);
        }

        public String toString() {
            return from + " -> " + to;
        }

        //#
        static long gcd(long a, long b) {
            a = Math.abs(a);
            b = Math.abs(b);
            return b == 0 ? a : gcd(b, a % b);
        }
        //$

        //returns the lattice point of intersection or null if it is nonlattice or does not exist
        public VecL latticeIntersect(SegL o) {
            if (!intersects(o)) {
                return null;
            }
            long dirGCD = gcd(dir.x, dir.y), oDirGCD = gcd(o.dir.x, o.dir.y);
            VecL va=new   VecL(dir.x / dirGCD, dir.y / dirGCD), vb = new VecL(o.dir.x / oDirGCD, o.dir.y / oDirGCD);
            if (va.x < 0 && va.y < 0) {
                va.x *= -1;
                va.y *= -1;
            }
            if (vb.x < 0 && vb.y < 0) {
                vb.x *= -1;
                vb.y *= -1;
            }
            if (va.equals(vb)) {
                return null;
            }
            long bottomScalar = va.x / gcd(va.x, va.y);
            long topScalar = va.y / gcd(va.x, va.y);
            long t2Scalar = -bottomScalar * vb.y + topScalar * vb.x;
            long t2Ans = bottomScalar * (o.from.y - from.y) - topScalar * (o.from.x - from.x);
            if (t2Ans % t2Scalar != 0) {
                return null;
            }
            long t2 = t2Ans / t2Scalar;
            return new VecL(t2 * vb.x + o.from.x, t2 * vb.y + o.from.y);
        }
    }

    static class FS {

        BufferedReader in;
        StringTokenizer token;

        public FS(InputStream str) {
            in = new BufferedReader(new InputStreamReader(str));
        }

        public String next() {
            if (token == null || !token.hasMoreElements()) {
                try {
                    token = new StringTokenizer(in.readLine());
                } catch (IOException ex) {
                }
                return next();
            }
            return token.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
public class Main3
{
    static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}
        public double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////
    //    RRRRRRRRR            AAA             HHH     HHH     IIIIIIIIIIIII   LLL           //
    //    RR    RRR           AAAAA            HHH     HHH      IIIIIIIIIII    LLL           //
    //    RR   RRR           AAAAAAA           HHH     HHH          III        LLL           //
    //    RR  RRR           AAA   AAA          HHHHHHHHHHH          III        LLL           //
    //    RRRRRR           AAA     AAA         HHHHHHHHHHH          III        LLL           //
    //    RR  RRR         AAAAAAAAAAAAA        HHH     HHH          III        LLL           //
    //    RR    RRR      AAA         AAA       HHH     HHH      IIIIIIIIIII    LLLLLLLLLLLL  //
    //    RR     RRR    AAA           AAA      HHH     HHH     IIIIIIIIIIIII   LLLLLLLLLLLL  //
    ///////////////////////////////////////////////////////////////////////////////////////////
    static int brr[][];
    static int arr[][];
    static class pair
    {
       int x;
       int y;
       public pair(int k, int p)
       {
           x = k;
           y = p;
       }
       @Override
       public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            pair pair = (pair) o;
            return x == pair.x && y == pair.y;
        }

       @Override
       public int hashCode() {
            return Objects.hash(x, y);
       }
    }
    static boolean onSegment(pair p, pair q, pair r)
    {
        if (q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y))
           return true;
        return false;
    }
    static int orientation(pair p, pair q, pair r)
    {
        int val = (q.y - p.y) * (r.x - q.x) -(q.x - p.x) * (r.y - q.y);
        if (val == 0) return 0;
        return (val > 0)? 1: 2;
    }
    static boolean doIntersect(pair p1, pair q1, pair p2, pair q2)
    {
        int o1 = orientation(p1, q1, p2);
        int o2 = orientation(p1, q1, q2);
        int o3 = orientation(p2, q2, p1);
        int o4 = orientation(p2, q2, q1);

        if (o1 != o2 && o3 != o4)
            return true;
        if (o1 == 0 && onSegment(p1, p2, q1)) return true;
        if (o2 == 0 && onSegment(p1, q2, q1)) return true;

        if (o3 == 0 && onSegment(p2, p1, q2)) return true;
        if (o4 == 0 && onSegment(p2, q1, q2)) return true;
        return false;
    }
    static boolean isInside(pair p)
    {
        pair extreme = new pair(1000000,p.y);
        int count = 0, i = 0;
        do
        {
            int next = (i+1)%4;
            if (doIntersect(new pair(arr[i][0],arr[i][1]), new pair(arr[next][0],arr[next][1]), p, extreme))
            {
                if (orientation(new pair(arr[i][0],arr[i][1]), p, new pair(arr[next][0],arr[next][1])) == 0)
                return onSegment(new pair(arr[i][0],arr[i][1]), p,new pair(arr[next][0],arr[next][1]));
                count++;
            }
            i = next;
        } while (i != 0);
        if(count%2==1)
        return true;
        return false;
    }
    public static void main(String[] args)throws IOException
    {
        PrintWriter out= new PrintWriter(System.out);
        Reader sc=new Reader();
        arr=new int[4][2];
        brr=new int[4][2];
        for(int i=0;i<4;i++)
        {
            arr[i][0]=sc.i();
            arr[i][1]=sc.i();
        }
        for(int i=0;i<4;i++)
        {
            brr[i][0]=sc.i();
            brr[i][1]=sc.i();
        }
        for(int i=0;i<4;i++)
        {
            for(int j=0;j<4;j++)
            {
                pair p1=new pair(arr[i][0],arr[i][1]);
                pair q1=new pair(arr[(i+1)%4][0],arr[(i+1)%4][1]);
                pair p2=new pair(brr[j][0],brr[j][1]);
                pair q2=new pair(brr[(j+1)%4][0],brr[(j+1)%4][1]);
                if(doIntersect(p1,q1,p2,q2))
                {
                    System.out.println("YES");
                    System.exit(0);
                }
            }
        }
        int flag=0;
        for(int j=0;j<4;j++)
        {
            if(!isInside(new pair(brr[j][0],brr[j][1])))
            {
                System.out.println("NO");
                System.exit(0);
            }
        }
        System.out.println("YES");
    }
}

import java.util.*;
import java.lang.Math.*;

public class Solution{

    static int[] n = new int[2];

    public static String solve(int[][] a, int[][] b) {
        if(check(a, b, n)){return "YES";}
        else{return "NO";}
    }

    private static Boolean check(int[][] a, int[][] b, int[] n){
        for(int i=-100;i<100;i++){
            for(int j=-100;j<100;j++){
                int[] p = new int[]{i,j};
                if(i<=a[1][0]&&i>=a[0][0]&&j<=a[2][1]&&j>=a[0][1]&&dist(p,n)<dist(b[0],n)){
                    return true;
                }
            }
        }
        return false;
    }

    private static double dist(int[] a, int[] b){
        return Math.sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));
    }

    private static int[][] transforma(int[][] a){
        int[] x_axis=new int[4];
        int[] y_axis=new int[4];
        int[][] square = new int[4][2];

        for(int i=0;i<4;i++){
            x_axis[i] = a[i][0];
            y_axis[i] = a[i][1];
        }

        int[] A= new int[]{getMin(x_axis), getMin(y_axis)};
        int[] B= new int[]{getMax(x_axis), getMin(y_axis)};
        int[] C= new int[]{getMax(x_axis), getMax(y_axis)};
        int[] D= new int[]{getMin(x_axis), getMax(y_axis)};

        square[0][0] = A[0];
        square[0][1] = A[1];
        square[1][0] = B[0];
        square[1][1] = B[1];
        square[2][0] = C[0];
        square[2][1] = C[1];
        square[3][0] = D[0];
        square[3][1] = D[1];

        return square;
    }

    private static int[][] transformb(int[][] b){
        int[] x_axis=new int[4];
        int[] y_axis=new int[4];
        int[][] square = new int[4][2];

        for(int i=0;i<4;i++){
            x_axis[i]=b[i][0];
            y_axis[i]=b[i][1];
        }

        int[] A= new int[]{getMin(x_axis), (getMax(y_axis)-getMin(y_axis))/2+getMin(y_axis)};
        int[] B= new int[]{(getMax(x_axis)-getMin(x_axis))/2+getMin(x_axis), getMax(y_axis)};
        int[] C= new int[]{getMax(x_axis), (getMax(y_axis)-getMin(y_axis))/2+getMin(y_axis)};
        int[] D= new int[]{(getMax(x_axis)-getMin(x_axis))/2+getMin(x_axis), getMin(y_axis)};

        n[0] = (getMax(x_axis)-getMin(x_axis))/2+getMin(x_axis);
        n[1] = (getMax(y_axis)-getMin(y_axis))/2+getMin(y_axis);

        square[0][0] = A[0];
        square[0][1] = A[1];
        square[1][0] = B[0];
        square[1][1] = B[1];
        square[2][0] = C[0];
        square[2][1] = C[1];
        square[3][0] = D[0];
        square[3][1] = D[1];

        return square;
    }

    public static int getMax(int[] inputArray){
        int maxValue = inputArray[0];
        for(int i=1;i < inputArray.length;i++){
            if(inputArray[i] > maxValue){
                maxValue = inputArray[i];
            }
        }
        return maxValue;
    }

    public static int getMin(int[] inputArray){
        int minValue = inputArray[0];
        for(int i=1;i<inputArray.length;i++){
        if(inputArray[i] < minValue){
            minValue = inputArray[i];
            }
        }
        return minValue;
    }

    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);

        int[][] a = new int[4][2];
        int[][] b = new int[4][2];

        for(int i=0;i<4;i++){
            for(int j=0;j<2;j++){
                a[i][j]=scan.nextInt();
            }
        }
        for(int i=0;i<4;i++){
            for(int j=0;j<2;j++){
                b[i][j]=scan.nextInt();
            }
        }

        System.out.println(solve(transforma(a),transformb(b)));
    }
}

import java.io.BufferedReader;
import java.io.IOError;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer stk = new StringTokenizer(br.readLine());
        Line[][] p = new Line[2][4];
        int[][][] arr = new int[2][4][2];
        int maxX = -10000000;
        int minX = 10000000;
        int maxY = - 10000000;
        int minY = 10000000;
        for(int i=0;i<4;i++){
            int x = Integer.parseInt(stk.nextToken());
            int y = Integer.parseInt(stk.nextToken());
            arr[0][i][0] = x;
            arr[0][i][1] = y;
            maxX = Math.max(maxX,x);
            minX = Math.min(minX,x);
            maxY = Math.max(maxY,y);
            minY = Math.min(minY,y);
        }
        stk = new StringTokenizer(br.readLine());
        for(int i=0;i<4;i++){
            int x = Integer.parseInt(stk.nextToken());
            int y = Integer.parseInt(stk.nextToken());
            arr[1][i][0] = x;
            arr[1][i][1] = y;
        }
        for(int i=0;i<4;i++){
            p[0][i] = new Line(arr[0][i][0],arr[0][i][1],arr[0][(i+1)%4][0],arr[0][(i+1)%4][1]);
        }
        for(int i=0;i<4;i++){
            p[1][i] = new Line(arr[1][i][0],arr[1][i][1],arr[1][(i+1)%4][0],arr[1][(i+1)%4][1]);
        }
        for(int i=0;i<4;i++){
            Line l1 = p[0][i];
            if(l1.x1==l1.x2){
                //vertical
                for(int j=0;j<4;j++){
                    int a = get(p[1][j]);
                    int b = get2(a,p[1][j]);
                        int interSectPoint = a*l1.x1 +b;
                    if(interSectPoint<=Math.max(p[1][j].y1,p[1][j].y2)&&interSectPoint>=Math.min(p[1][j].y1,p[1][j].y2)
                            &&l1.x1>=Math.min(p[1][j].x1,p[1][j].x2) && l1.x1<= Math.max(p[1][j].x1,p[1][j].x2)
                            &&
                            interSectPoint<=Math.max(l1.y1,l1.y2)
                            &&
                            interSectPoint>=Math.min(l1.y1,l1.y2)){
                            System.out.println("YES");
                        //    System.out.println(l1.x1+" "+interSectPoint);
                            return; }
                }
            }
            else{
                for(int j=0;j<4;j++){
                    int a = get(p[1][j]);
                    int b = get2(a,p[1][j]);
                    int interSectPoint = a*(l1.y1-b);
                  //  System.out.println(interSectPoint+" "+l1.y1+" "+p[1][j].x1+" "+p[1][j].y1+" "+p[1][j].x2+" "+p[1][j].y2);
                    if(interSectPoint<=Math.max(p[1][j].x1,p[1][j].x2)
                            &&
                            interSectPoint>=Math.min(p[1][j].x1,p[1][j].x2)
                            &&
                            l1.y1>=Math.min(p[1][j].y1,p[1][j].y2)
                            &&
                            l1.y1<= Math.max(p[1][j].y1,p[1][j].y2)
                            &&
                            interSectPoint<=Math.max(l1.x1,l1.x2)
                            &&
                            interSectPoint>=Math.min(l1.x1,l1.x2)){
                      //  System.out.println(interSectPoint+" "+l1.y1);
                        System.out.println("YES");return; }
                }
            }
        }
        boolean flag = true;
        for(int i=0;i<4;i++){
            if(!(arr[1][i][0]>=minX&&arr[1][i][0]<=maxX&&arr[1][i][1]>=minY&&arr[1][i][1]<=maxY)){
                flag = false;
            }
        }
        if (flag) {
            System.out.println("YES"); return;
        }
        System.out.println("NO");
    }
    static int get(Line l){
        return (l.y1-l.y2)/(l.x1-l.x2);
    }
    static int get2(int a,Line l){
        return l.y1-(a*l.x1);
    }
    static class Line {
        int x1,y1,x2,y2;
        public Line(int x1,int y1,int x2,int y2){
            this.x1 = x1;
            this.x2 = x2;
            this.y1 = y1;
            this.y2 = y2;
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class C {
    static class Point {
        int x,y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Point point = (Point) o;
            return x == point.x &&
                    y == point.y;
        }

        @Override
        public int hashCode() {

            return Objects.hash(x, y);
        }

        @Override
        public String toString() {
            return x+","+y;
        }
    }
    static class Square {
        List<Point> points = new ArrayList<>();
    }

    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();

        Square A = readSquare(scanner);
        Square B = readSquare(scanner);

        Set<Point> regions = new HashSet<>();

        draw(regions, B.points.get(0), B.points.get(1));
        draw(regions, B.points.get(1), B.points.get(2));
        draw(regions, B.points.get(2), B.points.get(3));
        draw(regions, B.points.get(3), B.points.get(0));

        int minx = A.points.stream().mapToInt(Point::getX).min().getAsInt();
        int maxx = A.points.stream().mapToInt(Point::getX).max().getAsInt();
        int miny = A.points.stream().mapToInt(Point::getY).min().getAsInt();
        int maxy = A.points.stream().mapToInt(Point::getY).max().getAsInt();

        for (int x=minx; x<=maxx; ++x) {
            for (int y=miny; y<=maxy;++y) {
                if (regions.contains(new Point(x,y))) {
                    System.out.println("YES");
                    return;
                }
            }
        }

        System.out.println("NO");
    }

    static void draw(Set<Point> regions, Point a, Point b) {
        List<Integer> xs = new ArrayList<>();
        List<Integer> ys = new ArrayList<>();
        if (a.x<b.x) {
            for (int x = a.x; x <= b.x; ++x) {
                xs.add(x);
            }
        } else {
            for (int x = a.x; x >= b.x; --x) {
                xs.add(x);
            }
        }
        if (a.y<b.y) {
            for (int y=a.y;y<=b.y;++y) {
                ys.add(y);
            }
        } else {
            for (int y=a.y;y>=b.y;--y) {
                ys.add(y);
            }
        }

        for (int i=0; i<xs.size();++i) {
            regions.add(new Point(xs.get(i), ys.get(i)));
            if (((a.x<b.x)&&(a.y>b.y))||(a.x>b.x)&&(a.y<b.y)) {
                for (int xx = xs.get(i); xx <= b.x; ++xx) {
                    regions.add(new Point(xx, ys.get(i)));
                }
                for (int xx = xs.get(i); xx >= b.x; --xx) {
                    regions.add(new Point(xx, ys.get(i)));
                }
            } else {
                for (int xx = xs.get(i); xx <= a.x; ++xx) {
                    regions.add(new Point(xx, ys.get(i)));
                }
                for (int xx = xs.get(i); xx >= a.x; --xx) {
                    regions.add(new Point(xx, ys.get(i)));
                }
            }
        }
        if (b.y<a.y && b.x<a.x) {
            regions.add(new Point(a.x,b.y));
        }
    }

    private static Square readSquare(FastScanner scanner) {
        Square A = new Square();
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        return A;
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.*;
import java.util.Arrays;
import java.util.StringJoiner;
import java.util.StringTokenizer;

public class Main {

    static Cord[] A, B;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        A = new Cord[4];
        for (int i = 0; i < 4; i++) {
            A[i] = new Cord(sc.nextInt(), sc.nextInt());
        }
        B = new Cord[4];
        for (int i = 0; i < 4; i++) {
            B[i] = new Cord(sc.nextInt(), sc.nextInt());
        }

        System.out.println(solve() ? "YES" : "NO");
    }

    static class Cord {
        int x, y;

        public Cord(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }

    static boolean solve() {
        Alpha a = new Alpha(ld(A), ru(A));
        Beta b = new Beta(u(B), d(B));

        for (int x = -100; x <= 100; x++) {
            for (int y = -100; y <= 100; y++) {
                if( a.contains(x, y) && b.contains(x, y) ) {
                    return true;
                }
            }
        }
        return false;
    }

    static Cord ld(Cord[] cs) {
        int x = cs[0].x;
        int y = cs[0].y;
        for (int i = 1; i < cs.length; i++) {
            x = Math.min(cs[i].x, x);
            y = Math.min(cs[i].x, y);
        }
        return new Cord(x, y);
    }

    static Cord ru(Cord[] cs) {
        int x = cs[0].x;
        int y = cs[0].y;
        for (int i = 1; i < cs.length; i++) {
            x = Math.max(cs[i].x, x);
            y = Math.max(cs[i].x, y);
        }
        return new Cord(x, y);
    }

    static Cord u(Cord[] cs) {
        int y = cs[0].y;
        for (int i = 1; i < cs.length; i++) {
            y = Math.max(cs[i].y, y);
        }
        for (Cord c : cs) {
            if( c.y == y ) return c;
        }
        throw new RuntimeException("wtf");
    }

    static Cord d(Cord[] cs) {
        int y = cs[0].y;
        for (int i = 1; i < cs.length; i++) {
            y = Math.min(cs[i].y, y);
        }
        for (Cord c : cs) {
            if( c.y == y ) return c;
        }
        throw new RuntimeException("wtf");
    }

    static class Beta {
        Cord u, d;

        public Beta(Cord u, Cord d) {
            this.u = u;
            this.d = d;
        }

        boolean contains(int x, int y) {
            return x + (d.y - d.x) <= y && x + (u.y - u.x) >= y // (a, b) -> y = x + (b-a)
                && -x + (d.y + d.x) <= y && -x + (u.y + u.x) >= y;// (a, b) -> y = -x + (a+b)
        }
    }

    static class Alpha {
        Cord ld, ru;

        public Alpha(Cord ld, Cord ru) {
            this.ld = ld;
            this.ru = ru;
        }

        boolean contains(int x, int y) {
            return ld.x <= x && x <= ru.x && ld.y <= y && y <= ru.y;
        }
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        int[] nextIntArray(int n, int delta) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt() + delta;
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) a[i] = nextLong();
            return a;
        }
    }

    static void writeLines(int[] as) {
        PrintWriter pw = new PrintWriter(System.out);
        for (int a : as) pw.println(a);
        pw.flush();
    }

    static void writeLines(long[] as) {
        PrintWriter pw = new PrintWriter(System.out);
        for (long a : as) pw.println(a);
        pw.flush();
    }

    static void writeSingleLine(int[] as) {
        PrintWriter pw = new PrintWriter(System.out);
        for (int i = 0; i < as.length; i++) {
            if (i != 0) pw.print(" ");
            pw.print(i);
        }
        pw.println();
        pw.flush();
    }

    static int max(int... as) {
        int max = Integer.MIN_VALUE;
        for (int a : as) max = Math.max(a, max);
        return max;
    }

    static int min(int... as) {
        int min = Integer.MAX_VALUE;
        for (int a : as) min = Math.min(a, min);
        return min;
    }

    static void debug(Object... args) {
        StringJoiner j = new StringJoiner(" ");
        for (Object arg : args) {
            if (arg instanceof int[]) j.add(Arrays.toString((int[]) arg));
            else if (arg instanceof long[]) j.add(Arrays.toString((long[]) arg));
            else if (arg instanceof double[]) j.add(Arrays.toString((double[]) arg));
            else if (arg instanceof Object[]) j.add(Arrays.toString((Object[]) arg));
            else j.add(arg == null ? "null" : arg.toString());
        }
        System.err.println(j.toString());
    }

    static void printSingleLine(int[] array) {
        for (int i = 0; i < array.length; i++) {
            if (i != 0) System.out.print(" ");
            System.out.print(array[i]);
        }
        System.out.println();
    }

    static int lowerBound(int[] array, int value) {
        int low = 0, high = array.length, mid;
        while (low < high) {
            mid = ((high - low) >>> 1) + low;
            if (array[mid] < value) low = mid + 1;
            else high = mid;
        }
        return low;
    }

    static int upperBound(int[] array, int value) {
        int low = 0, high = array.length, mid;
        while (low < high) {
            mid = ((high - low) >>> 1) + low;
            if (array[mid] <= value) low = mid + 1;
            else high = mid;
        }
        return low;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by Arihant Jain on 6/16/2018.
 */
public class twoSquares {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String out[] = br.readLine().split(" ");
        int parallelX[] = new int[4];
        int parallelY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            parallelX[i/2] = Integer.parseInt(out[i]);
            parallelY[i/2] = Integer.parseInt(out[i+1]);
        }
        int x1 = Math.min(parallelX[0],parallelX[2]);
        int x2 = Math.max(parallelX[0], parallelX[2]);
        int y1 = Math.min(parallelY[0],parallelY[2]);
        int y2 = Math.max(parallelY[0], parallelY[2]);
        out = br.readLine().split(" ");
        int diagonalGivenX[] = new int[4];
        int diagonalGivenY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            diagonalGivenX[i/2] = Integer.parseInt(out[i])+100;
            diagonalGivenY[i/2] = Integer.parseInt(out[i+1])+100;
        }
        int xMin = 0;
        int xMax = 0;
        int yMin = 0;
        int yMax = 0;
        for (int i =1; i<4; i++) {
            if (diagonalGivenX[i]<diagonalGivenX[xMin])
                xMin = i;
            if (diagonalGivenX[i]>diagonalGivenX[xMax])
                xMax = i;
            if (diagonalGivenY[i]<diagonalGivenY[yMin])
                yMin = i;
            if (diagonalGivenY[i]>diagonalGivenY[yMax])
                yMax = i;
        }
        int[] diagonalX = new int[4];
        int[] diagonalY = new int[4];
        diagonalX[0] = diagonalGivenX[xMin];
        diagonalX[1] = diagonalGivenX[yMax];
        diagonalX[2] = diagonalGivenX[xMax];
        diagonalX[3] = diagonalGivenX[yMin];
        diagonalY[0] = diagonalGivenY[xMin];
        diagonalY[1] = diagonalGivenY[yMax];
        diagonalY[2] = diagonalGivenY[xMax];
        diagonalY[3] = diagonalGivenY[yMin];
        for (int i =0; i<4; i++) {
            if (diagonalX[i]>=x1 && diagonalX[i]<= x2 && diagonalY[i]>=y1 && diagonalY[i]<=y2) {
                System.out.println("YES");
                return;
            }
        }
        for (int i =0; i<4; i++) {
            int x = parallelX[i];
            int y = parallelY[i];
            if (y<=x+diagonalY[0]-diagonalX[0] && y<=-1*x+diagonalX[1]+diagonalY[1] && y>=x-diagonalX[2]+diagonalY[2] && y>=-1*x+diagonalX[3]+diagonalY[3]) {
                System.out.println("YES");
                return;
            }
        }
        int x = (x1+x2)/2;
        int y = (y1+y1/2);
        if (y<=x+diagonalY[0]-diagonalX[0] && y<=-1*x+diagonalX[1]+diagonalY[1] && y>=x-diagonalX[2]+diagonalY[2] && y>=-1*x+diagonalX[3]+diagonalY[3]) {
            System.out.println("YES");
            return;
        }
        System.out.println("NO");
    }
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.util.stream.IntStream;

public class C {

    int[] x1,y1,x2,y2;

    private boolean intersect(int[] a,int[] b,int[] c,int[] d) {

        // 座標軸に平行な正方形の座標
        int minX1 = Arrays.stream(a).min().getAsInt();
        int maxX1 = Arrays.stream(a).max().getAsInt();
        int minY1 = Arrays.stream(b).min().getAsInt();
        int maxY1 = Arrays.stream(b).min().getAsInt();

        // 座標軸に対して45度回転している正方形の座標
        int minX2 = Arrays.stream(c).min().getAsInt();
        int maxX2 = Arrays.stream(c).min().getAsInt();
        int minY2 = Arrays.stream(d).min().getAsInt();
        int maxY2 = Arrays.stream(d).min().getAsInt();

        // x座標について境界チェック
        if ((minX1 <= minX2 && minX2 <= maxX1) ||
                (minX1 <= maxX2 && maxX2 <= maxX1)) {
            return true;
        }

        // y座標について境界チェック
        if ((minY1 <= minY2 && minY2 <= maxY1) ||
                (minY1 <= maxY2 && maxY2 <= maxY1)) {
            return true;
        }

        return false;
    }

    private boolean contains(int[] a,int[] b,int[] c,int[] d) {
        int[] aa = Arrays.copyOf(a, a.length);
        int[] bb = Arrays.copyOf(b, b.length);
        int[] cc = Arrays.copyOf(c, c.length);
        int[] dd = Arrays.copyOf(d, d.length);

        Arrays.sort(aa);
        Arrays.sort(bb);
        Arrays.sort(cc);
        Arrays.sort(dd);

        if (aa[0] <= cc[1] && cc[1] <= aa[3] && bb[0] <= dd[1] && dd[1] <= bb[3]) {
            return true;
        }
        return false;
    }

    private void rotate(int[] x,int[] y) {
        for(int i = 0;i < 4;i++) {
            int tmpX = x[i] + y[i];
            int tmpY = x[i] - y[i];
            x[i] = tmpX;
            y[i] = tmpY;
        }
    }

    private void solve() {
        x1 = new int[4];
        y1 = new int[4];
        for(int i = 0;i < 4;i++) {
            x1[i] = nextInt();
            y1[i] = nextInt();
        }

        x2 = new int[4];
        y2 = new int[4];
        for(int i = 0;i < 4;i++) {
            x2[i] = nextInt();
            y2[i] = nextInt();
        }

        if (intersect(x1, y1, x2, y2) || contains(x1, y1, x2, y2)) {
            out.println("YES");
            return;
        }

        rotate(x1, y1);
        rotate(x2, y2);

        if (intersect(x2, y2, x1, y1) || contains(x2, y2, x1, y1)) {
            out.println("YES");
            return ;
        }

        out.println("NO");
    }

    public static void main(String[] args) {
        out.flush();
        new C().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

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

public class C994{
	static double area(int x1,int y1,int x2,int y2,int x3,int y3){
		return Math.abs((x1 * (y2 - y3) +
        x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
	}
	public static void main(String args[])throws IOException{
		Scanner sc=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		PrintWriter pw=new PrintWriter(System.out);
		int x11=sc.nextInt();
		int y11=sc.nextInt();
		int x12=sc.nextInt();
		int y12=sc.nextInt();
		int x13=sc.nextInt();
		int y13=sc.nextInt();
		int x14=sc.nextInt();
		int y14=sc.nextInt();
		int x21=sc.nextInt();
		int y21=sc.nextInt();
		int x22=sc.nextInt();
		int y22=sc.nextInt();
		int x23=sc.nextInt();
		int y23=sc.nextInt();
		int x24=sc.nextInt();
		int y24=sc.nextInt();
		double a1=area(x11,y11,x12,y12,x13,y13)+area(x11,y11,x13,y13,x14,y14);
		double a2=area(x21,y21,x22,y22,x23,y23)+area(x21,y21,x23,y23,x24,y24);
		if(a1==area(x11,y11,x12,y12,x21,y21)+area(x11,y11,x21,y21,x14,y14)+area(x21,y21,x12,y12,x13,y13)+area(x21,y21,x14,y14,x13,y13)){
			pw.println("YES");
			pw.close();
			return;
		}
		if(a1==area(x11,y11,x12,y12,x22,y22)+area(x11,y11,x22,y22,x14,y14)+area(x22,y22,x12,y12,x13,y13)+area(x22,y22,x14,y14,x13,y13)){
			pw.println("YES");
			pw.close();
			return;
		}
		if(a1==area(x11,y11,x12,y12,x23,y23)+area(x11,y11,x23,y23,x14,y14)+area(x23,y23,x12,y12,x13,y13)+area(x23,y23,x14,y14,x13,y13)){
			pw.println("YES");
			pw.close();
			return;
		}
		if(a1==area(x11,y11,x12,y12,x24,y24)+area(x11,y11,x24,y24,x14,y14)+area(x24,y24,x12,y12,x13,y13)+area(x24,y24,x14,y14,x13,y13)){
			pw.println("YES");
			pw.close();
			return;
		}
		if(a2==area(x21,y21,x22,y22,x11,y11)+area(x21,y21,x11,y11,x24,y24)+area(x11,y11,x22,y22,x23,y23)+area(x11,y11,x24,y24,x23,y23)){
			pw.println("YES");
			pw.close();
			return;
		}
		if(a2==area(x21,y21,x22,y22,x12,y12)+area(x21,y21,x12,y12,x24,y24)+area(x12,y12,x22,y22,x23,y23)+area(x12,y12,x24,y24,x23,y23)){
			pw.println("YES");
			pw.close();
			return;
		}
		if(a2==area(x21,y21,x22,y22,x13,y13)+area(x21,y21,x13,y13,x24,y24)+area(x13,y13,x22,y22,x23,y23)+area(x13,y13,x24,y24,x23,y23)){
			pw.println("YES");
			pw.close();
			return;
		}
		if(a2==area(x21,y21,x22,y22,x14,y14)+area(x21,y21,x14,y14,x24,y24)+area(x14,y14,x22,y22,x23,y23)+area(x14,y14,x24,y24,x23,y23)){
			pw.println("YES");
			pw.close();
			return;
		}

		pw.println("NO");
		pw.close();
	}
}

import java.io.*;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class C {
    static class FastWriter {
        private final BufferedWriter bw;

        public FastWriter() {
            this.bw = new BufferedWriter(new OutputStreamWriter(System.out));
        }

        public void print(Object object) throws IOException {
            bw.append("" + object);
        }

        public void println(Object object) throws IOException {
            print(object);
            bw.append("\n");
        }

        public void close() throws IOException {
            bw.close();
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        BigInteger nextBigInteger() {
            try {
                return new BigInteger(nextLine());
            } catch (NumberFormatException e) {
                throw new InputMismatchException();
            }
        }
    }

    public static class point implements Comparable<point> {
        double x;
        double y;

        point(double x, double y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(point o) {
            double a = this.x + this.y;
            double b = o.x + o.y;
            if (a == b) {
                return (int) (this.y - o.y);
            } else {
                return (int) (a - b);
            }
        }
    }

    public static class line {
        double x;
        double y;

        line(point a, point b, double x) {
            this.x = x;
            this.y = (((b.y - a.y) * (x - a.x)) / (b.x - a.x)) + a.y;
        }
    }

    public static void main(String[] args) {
        FastReader fr = new FastReader();
        FastWriter fw = new FastWriter();
        point[] one = new point[4];
        point[] two = new point[4];
        for (int i = 0; i < 4; i++) {
            one[i] = new point(fr.nextInt(), fr.nextInt());
        }

        for (int i = 0; i < 4; i++) {
            two[i] = new point(fr.nextInt(), fr.nextInt());
        }
        Arrays.sort(one);
        point temp = one[3];
        one[3] = one[2];
        one[2] = temp;

        point five = new point((two[2].x + two[0].x) / 2, (two[2].y + two[0].y) / 2);
        point[] tarr = two;
        two = new point[5];
        for (int i = 0; i < tarr.length; i++) two[i] = tarr[i];
        two[4] = five;
        for (int i = 0; i < 5; i++) {
            double vala = one[0].y - two[i].y;
            double valb = one[2].y - two[i].y;
            double valc = one[2].x - two[i].x;
            double vald = one[0].x - two[i].x;

            if ((vala >= 0 && valb <= 0 || vala <= 0 && valb >= 0) && (valc >= 0 && vald <= 0 || valc <= 0 && vald >= 0)) {
                System.out.println("YES");
                return;
            }

//            if (vala == 0 || valb == 0 || valc == 0 || vald == 0) {
//                System.out.println("YES");
//                return;
//            }
        }
        for (int i = 0; i < 4; i++) {
            line a = new line(two[0], two[1], one[i].x);
            line b = new line(two[2], two[3], one[i].x);

            line c = new line(two[1], two[2], one[i].x);
            line d = new line(two[3], two[0], one[i].x);

            double vala = one[i].y - a.y;
            double valb = one[i].y - b.y;
            double valc = one[i].y - c.y;
            double vald = one[i].y - d.y;

            if ((vala > 0 && valb < 0 || vala < 0 && valb > 0) && (valc > 0 && vald < 0 || valc < 0 && vald > 0)) {
                System.out.println("YES");
                return;
            }
            if (vala == 0 || valb == 0 || valc == 0 || vald == 0) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

import java.util.*;
import java.awt.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x1[] = new int[4];
        int y1[] = new int[4];
        int x2[] = new int[4];
        int y2[] = new int[4];

        for( int i=0; i<4; i++ ) {
                x2[i] = sc.nextInt();
                y2[i] = sc.nextInt();
        }

        for( int i=0; i<4; i++ ) {
                x1[i] = sc.nextInt();
                y1[i] = sc.nextInt();
        }

        Polygon P = new Polygon( x1, y1, 4 );

        double x, y;
        double w, h;

        x = x2[0];
        y = y2[0];

        double xx = x2[0] - x2[1];

        double yy = y2[0] - y2[1];

        w = Math.sqrt( xx * xx + yy * yy );

        h = Math.sqrt( xx * xx + yy * yy );

        if( P.intersects( x, y, w, h ) ) {
                System.out.println( "YES" );
        }
        else {
                System.out.println( "NO" );
        }
    }
}

//package round488;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class A {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = 4;
		int[][] coa = new int[n][];
		for(int i = 0;i < n;i++){
			coa[i] = new int[]{ni(), ni()};
		}
		int[][] cob = new int[n][];
		for(int i = 0;i < n;i++){
			cob[i] = new int[]{ni(), ni()};
		}

		for(int i = 0;i < n;i++){
			for(int j = 0;j < n;j++){
				if(hasCommonPoint(
						coa[i], coa[(i+1)%n],
						cob[i], cob[(i+1)%n]
								)){
					out.println("YES");
					return;
				}
			}
		}

		for(int i = 0;i < n;i++){
			int sum = 0;
			for(int j = 0;j < n;j++){
				sum += ccw(coa[j], coa[(j+1)%n], cob[i]);
			}
			if(sum == n || sum == -n){
				out.println("YES");
				return;
			}
		}
		for(int i = 0;i < n;i++){
			int sum = 0;
			for(int j = 0;j < n;j++){
				sum += ccw(cob[j], cob[(j+1)%n], coa[i]);
			}
			if(sum == n || sum == -n){
				out.println("YES");
				return;
			}
		}
		out.println("NO");
	}

	public static int ccw(int[] a, int[] b, int[] t){ return Long.signum((long)(t[0]-a[0])*(b[1]-a[1])-(long)(b[0]-a[0])*(t[1]-a[1])); }

	public static boolean hasCommonPoint(int[] a, int[] b, int[] c, int[] d){ return hasCommonPoint(a[0], a[1], b[0], b[1], c[0], c[1], d[0], d[1]);}

	public static boolean hasCommonPoint(long ax, long ay, long bx, long by, long cx, long cy, long dx, long dy)
	{
		long c1 = (cx-ax)*(by-ay)-(cy-ay)*(bx-ax);
		long c2 = (dx-ax)*(by-ay)-(dy-ay)*(bx-ax);
		if(c1 < 0 && c2 < 0 || c1 > 0 && c2 > 0)return false;
		long d1 = (ax-cx)*(dy-cy)-(ay-cy)*(dx-cx);
		long d2 = (bx-cx)*(dy-cy)-(by-cy)*(dx-cx);
		if(d1 < 0 && d2 < 0 || d1 > 0 && d2 > 0)return false;
		if(c1 == 0 && c2 == 0 && d1 == 0 && d2 == 0){
			if(ax == bx && ay == by){
				return (cx-ax)*(dx-ax)+(cy-ay)*(dy-ay) <= 0;
			}else{
				long posc = (cx-ax)*(bx-ax)+(cy-ay)*(by-ay);
				long posd = (dx-ax)*(bx-ax)+(dy-ay)*(by-ay);
				long den = (bx-ax)*(bx-ax)+(by-ay)*(by-ay);
	//			return Math.max(0, Math.min(posc, posd)) <= Math.min(den, Math.max(posc, posd));
	//			return Math.min(posc, posd) <= den && 0 <= Math.max(posc, posd);
				return (posc <= den || posd <= den) && (0 <= posc || 0 <= posd);
			}
		}
		return true;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new A().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

import java.util.*;
public class TwoSquares {
	static class Coord{
		int x, y;
		Coord(int a, int b){
			this.x = a;
			this.y = b;
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Coord[] s1 = new Coord[4];
		Coord[] s2 = new Coord[4];
		ArrayList<Integer> mx = new ArrayList<Integer>();
		ArrayList<Integer> my = new ArrayList<Integer>();
		for (int i=0; i<4; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			mx.add(x);
			my.add(y);
			s1[i] = new Coord(x, y);
		}
		for (int i=0; i<4; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			s2[i] = new Coord(x, y);
		}
		for (Coord c : s2) {
			if (c.x<=Collections.max(mx)&&c.x>=Collections.min(mx)&&c.y<=Collections.max(my)&&c.y>=Collections.min(my)) {
				System.out.println("YES");
				return;
			}
		}for (int i=0; i<4; i++) {
			s1[i] = new Coord(s1[i].x+s1[i].y, s1[i].x-s1[i].y);
		}for (int i=0; i<4; i++) {
			s2[i] = new Coord(s2[i].x+s2[i].y, s2[i].x-s2[i].y);
		}
		mx.clear();
		my.clear();
		for (int i=0; i<4; i++) {
			mx.add(s2[i].x);
			my.add(s2[i].y);
		}
		for (Coord c : s1) {
			if (c.x<=Collections.max(mx)&&c.x>=Collections.min(mx)&&c.y<=Collections.max(my)&&c.y>=Collections.min(my)) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}

}

/**
 * Date: 16 Jun, 2018
 * Link:
 *
 * @author Prasad-Chaudhari
 * @email prasadc8897@gmail.com
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class newProgram5 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        Point a1 = new Point(in.nd(), in.nd());
        Point a2 = new Point(in.nd(), in.nd());
        Point a3 = new Point(in.nd(), in.nd());
        Point a4 = new Point(in.nd(), in.nd());

        Point b1 = new Point(in.nd(), in.nd());
        Point b2 = new Point(in.nd(), in.nd());
        Point b3 = new Point(in.nd(), in.nd());
        Point b4 = new Point(in.nd(), in.nd());

        if (getArea(a1, a2, b1) + getArea(a2, a3, b1) + getArea(a3, a4, b1) + getArea(a4, a1, b1) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(a1, a2, b2) + getArea(a2, a3, b2) + getArea(a3, a4, b2) + getArea(a4, a1, b2) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(a1, a2, b4) + getArea(a2, a3, b4) + getArea(a3, a4, b4) + getArea(a4, a1, b4) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(a1, a2, b3) + getArea(a2, a3, b3) + getArea(a3, a4, b3) + getArea(a4, a1, b3) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(b1, b2, a3) + getArea(b2, b3, a3) + getArea(b3, b4, a3) + getArea(b4, b1, a3) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(b1, b2, a1) + getArea(b2, b3, a1) + getArea(b3, b4, a1) + getArea(b4, b1, a1) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(b1, b2, a2) + getArea(b2, b3, a2) + getArea(b3, b4, a2) + getArea(b4, b1, a2) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(b1, b2, a4) + getArea(b2, b3, a4) + getArea(b3, b4, a4) + getArea(b4, b1, a4) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }

    private static double getArea(Point a, Point b, Point c) {
        double ans = Math.abs(0.5 * (a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y)));
        return ans;
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

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

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

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

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
            bw.flush();
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
            bw.flush();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}

class Point {

    double x, y;

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

}

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

public class check {
    static boolean DEBUG_FLAG = false;
    int INF = (int)1e9;
    long MOD = 1000000007;

    static void debug(String s) {
        if(DEBUG_FLAG) {
            System.out.print(s);
        }
    }

    boolean go(int x1, int x2, int y1, int y2, int x, int y) {
        if(x1<=x && x<=x2) {
            if(y1<=y && y<=y2) {
                return true;
            }
        }
        return false;
    }

    boolean cross(int[][] a, int[][] b) {
        double x = 0;
        for(int i=0; i<4; i++) {
            for(int j=0; j<4; j++) {
                if(i!=j && a[i][0]==a[j][0]) {
                    x = Math.abs(a[i][1]-a[j][1]);
                }
            }
        }
        x *= x;
        x /= 2;
        for(int i=0; i<4; i++) {
            double y = ar(b[i][0], b[i][1], a[0][0], a[0][1], a[3][0], a[3][1]);
            y += ar(b[i][0], b[i][1], a[2][0], a[2][1], a[3][0], a[3][1]);
            y += ar(b[i][0], b[i][1], a[2][0], a[2][1], a[1][0], a[1][1]);
            y += ar(b[i][0], b[i][1], a[0][0], a[0][1], a[1][0], a[1][1]);
            if(y==x) return true;
        }
        return false;
    }

    double ar(int x1, int y1, int x2, int y2, int x3, int y3) {
        double a = x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2);
        if(a<0) a = -a;
        a/=2;
        return a;
    }

    void solve(InputReader in, PrintWriter out) throws IOException {
        int x1 = INF, x2 = -INF;
        int y1 = INF, y2 = -INF;
        int[][] b = new int[4][2];
        for(int i=0; i<4; i++) {
            int x = in.nextInt();
            int y = in.nextInt();
            x1 = Math.min(x, x1);
            x2 = Math.max(x, x2);
            y1 = Math.min(y, y1);
            y2 = Math.max(y, y2);
            b[i][0] = x;
            b[i][1] = y;
        }
        boolean f = false;
        int[][] a = new int[4][2];
        for(int i=0; i<4; i++) {
            a[i][0] = in.nextInt();
            a[i][1] = in.nextInt();
            f = f | go(x1, x2, y1, y2, a[i][0], a[i][1]);
        }
        f = f | cross(a, b);
        if(f) {
            out.println("YES");
        } else {
            out.println("NO");
        }
    }

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new check().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }

    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Asgar Javadov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int[] s1 = in.readIntArray(8);
            int[] s2 = in.readIntArray(8);

            int[] x1 = new int[4];
            int[] y1 = new int[4];
            int[] x2 = new int[4];
            int[] y2 = new int[4];

            for (int i = 0; i < s1.length; i += 2) {
                x1[i / 2] = s1[i];
                y1[i / 2] = s1[i + 1];
            }

            for (int i = 0; i < s2.length; i += 2) {
                x2[i / 2] = s2[i];
                y2[i / 2] = s2[i + 1];
            }

            for (int i = 0; i < 4; ++i) {
                if (pointInSquare(x1[i], y1[i], x2, y2)) {
                    out.yes();
                    return;
                }
            }

            for (int i = 0; i < 4; ++i) {
                if (pointInSquare(x2[i], y2[i], x1, y1)) {
                    out.yes();
                    return;
                }
            }

            out.no();
        }

        private boolean pointInSquare(int x, int y, int[] px, int[] py) {
            boolean pos = false;
            boolean neg = false;

            for (int i = 0; i < px.length; ++i) {
                int side = area(x, y, px[i], py[i], px[(i + 1) % px.length], py[(i + 1) % px.length]);
                if (side > 0) pos = true;
                else if (side < 0) neg = true;
            }
            return pos != neg;
        }

        private int area(int x1, int y1, int x2, int y2, int x3, int y3) {
            int area = x1 * y2 + x2 * y3 + x3 * y1 - (y1 * x2 + y2 * x3 + y3 * x1);
            return area > 0 ? 1 : area < 0 ? -1 : 0;
        }

    }

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void yes() {
            println("Yes");
        }

        public void no() {
            println("No");
        }

        public void close() {
            super.close();
        }

    }

    static class InputReader extends BufferedReader {
        StringTokenizer tokenizer;

        public InputReader(InputStream inputStream) {
            super(new InputStreamReader(inputStream), 32768);
        }

        public InputReader(String filename) {
            super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(readLine());
                } catch (IOException e) {
                    throw new RuntimeException();
                }
            }
            return tokenizer.nextToken();
        }

        public Integer nextInt() {
            return Integer.valueOf(next());
        }

        public int[] readIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
                array[i] = nextInt();
            return array;
        }

    }
}

// CodeForces Round #799 C Fountains training TODO

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class TwoSquares {

	class Point {
		int x,y;
	}

	Point []a;
	Point []b;
	boolean intersect;

	private void readData(BufferedReader bin) throws IOException {
		String s = bin.readLine();
		String []ss = s.split(" ");
		a = new Point[4];
		b = new Point[4];
		for (int i=0; i<4; i++) {
			a[i] = new Point();
			b[i] = new Point();
		}
		a[0].x = Integer.parseInt(ss[0]);
		a[0].y = Integer.parseInt(ss[1]);
		a[1].x = Integer.parseInt(ss[2]);
		a[1].y = Integer.parseInt(ss[3]);
		a[2].x = Integer.parseInt(ss[4]);
		a[2].y = Integer.parseInt(ss[5]);
		a[3].x = Integer.parseInt(ss[6]);
		a[3].y = Integer.parseInt(ss[7]);
		s = bin.readLine();
		ss = s.split(" ");
		b[0].x = Integer.parseInt(ss[0]);
		b[0].y = Integer.parseInt(ss[1]);
		b[1].x = Integer.parseInt(ss[2]);
		b[1].y = Integer.parseInt(ss[3]);
		b[2].x = Integer.parseInt(ss[4]);
		b[2].y = Integer.parseInt(ss[5]);
		b[3].x = Integer.parseInt(ss[6]);
		b[3].y = Integer.parseInt(ss[7]);
	}

	void printRes() {
		System.out.println(intersect ? "YES" : "NO");
	}

	boolean insideA(int x, int y) {
		boolean insx = a[0].x <= x && x <= a[2].x;
		boolean insy = a[0].y <= y && y <= a[2].y;
		return insx && insy;
	}

	Point []bb = new Point[4];
	int mnx=1000111,mny=1000111,mxx=-1000222,mxy=-1000222;
	void countBB() {
		for (int i=0; i<4; i++) {
			bb[i] = new Point();
			bb[i].x = b[i].x + b[i].y;
			bb[i].y = b[i].x - b[i].y;
			if (mnx > bb[i].x) {
				mnx = bb[i].x;
			}
			mny = Math.min(mny, bb[i].y);
			mxx = Math.max(mxx, bb[i].x);
			mxy = Math.max(mxy, bb[i].y);
		}
	}

	boolean insideB(int x, int y) {
		int cx = x+y;
		int cy = x-y;
		boolean insx = mnx <= cx && cx <= mxx;
		boolean insy = mny <= cy && cy <= mxy;
		return insx && insy;
	}

	private void calculate() {
		countBB();
		for (int i=0; i<4; i++) {
			if (insideB(a[i].x, a[i].y)) {
				intersect = true;
				return;
			}
		}
		for (int i=0; i<4; i++) {
			if (insideA(b[i].x, b[i].y)) {
				intersect = true;
				return;
			}
		}
		int bcx = (b[0].x + b[2].x)/2;
		int bcy = (b[0].y + b[2].y)/2;
		if (insideA(bcx, bcy)) {
			intersect = true;
			return;
		}
		intersect = false;
	}

	public static void main(String[] args) throws IOException {
		// BufferedReader bin = new BufferedReader(new FileReader("cactus.in"));
		BufferedReader bin = new BufferedReader(
				new InputStreamReader(System.in));
		TwoSquares l = new TwoSquares();
		l.readData(bin);
		l.calculate();
		l.printRes();
	}
}

// CodeForces Round #799 C Fountains training TODO

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class TwoSquares {

	class Point {
		int x,y;
	}

	Point []a;
	Point []b;
	boolean intersect;

	private void readData(BufferedReader bin) throws IOException {
		String s = bin.readLine();
		String []ss = s.split(" ");
		a = new Point[4];
		b = new Point[4];
		for (int i=0; i<4; i++) {
			a[i] = new Point();
			b[i] = new Point();
		}
		a[0].x = Integer.parseInt(ss[0]);
		a[0].y = Integer.parseInt(ss[1]);
		a[1].x = Integer.parseInt(ss[2]);
		a[1].y = Integer.parseInt(ss[3]);
		a[2].x = Integer.parseInt(ss[4]);
		a[2].y = Integer.parseInt(ss[5]);
		a[3].x = Integer.parseInt(ss[6]);
		a[3].y = Integer.parseInt(ss[7]);
		s = bin.readLine();
		ss = s.split(" ");
		b[0].x = Integer.parseInt(ss[0]);
		b[0].y = Integer.parseInt(ss[1]);
		b[1].x = Integer.parseInt(ss[2]);
		b[1].y = Integer.parseInt(ss[3]);
		b[2].x = Integer.parseInt(ss[4]);
		b[2].y = Integer.parseInt(ss[5]);
		b[3].x = Integer.parseInt(ss[6]);
		b[3].y = Integer.parseInt(ss[7]);
	}

	void printRes() {
		System.out.println(intersect ? "YES" : "NO");
	}

	Point []bb = new Point[4];
	int amnx=1000111,amny=1000111,amxx=-1000222,amxy=-1000222;
	int mnx=1000111,mny=1000111,mxx=-1000222,mxy=-1000222;
	void countAA() {
		for (int i=0; i<4; i++) {
			amnx = Math.min(amnx, a[i].y);
			amny = Math.min(amny, a[i].y);
			amxx = Math.max(amxx, a[i].x);
			amxy = Math.max(amxy, a[i].y);
		}
	}

	boolean insideA(int x, int y) {
		boolean insx = amnx <= x && x <= amxx;
		boolean insy = amny <= y && y <= amxy;
		return insx && insy;
	}
	void countBB() {
		for (int i=0; i<4; i++) {
			bb[i] = new Point();
			bb[i].x = b[i].x + b[i].y;
			bb[i].y = b[i].x - b[i].y;
			if (mnx > bb[i].x) {
				mnx = bb[i].x;
			}
			mny = Math.min(mny, bb[i].y);
			mxx = Math.max(mxx, bb[i].x);
			mxy = Math.max(mxy, bb[i].y);
		}
	}

	boolean insideB(int x, int y) {
		int cx = x+y;
		int cy = x-y;
		boolean insx = mnx <= cx && cx <= mxx;
		boolean insy = mny <= cy && cy <= mxy;
		return insx && insy;
	}

	private void calculate() {
		countAA();
		countBB();
		for (int i=0; i<4; i++) {
			if (insideB(a[i].x, a[i].y)) {
				intersect = true;
				return;
			}
		}
		for (int i=0; i<4; i++) {
			if (insideA(b[i].x, b[i].y)) {
				intersect = true;
				return;
			}
		}
		int bcx = (b[0].x + b[2].x)/2;
		int bcy = (b[0].y + b[2].y)/2;
		if (insideA(bcx, bcy)) {
			intersect = true;
			return;
		}
		intersect = false;
	}

	public static void main(String[] args) throws IOException {
		// BufferedReader bin = new BufferedReader(new FileReader("cactus.in"));
		BufferedReader bin = new BufferedReader(
				new InputStreamReader(System.in));
		TwoSquares l = new TwoSquares();
		l.readData(bin);
		l.calculate();
		l.printRes();
	}
}

//package baobab;

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

public class C {

    public static void main(String[] args) {
        Solver solver = new Solver();
    }

    static class Solver {
        IO io;

        public Solver() {
            this.io = new IO();
            try {
                solve();
            } catch (RuntimeException e) {
                if (!e.getMessage().equals("Clean exit")) {
                    throw e;
                }
            } finally {
                io.close();
            }
        }

        /****************************** START READING HERE ********************************/

        void solve() {
            List<Point> a = new ArrayList<>(4);
            List<Point> b = new ArrayList<>(4);
            for (int i=0; i<4; i++) a.add(new Point(io.nextInt(), io.nextInt()));
            for (int i=0; i<4; i++) b.add(new Point(io.nextInt(), io.nextInt()));
            if (countPointsInside(a,b) >= 1) done("YES");
            if (countPointsInside(b,a) >= 1) done("YES");
            if (anyPointTouchesAnySegment(a,b)) done("YES");
            if (anyPointTouchesAnySegment(b,a)) done("YES");
            io.println("NO");
        }

        boolean anyPointTouchesAnySegment(List<Point> points, List<Point> segments) {
            for (Point p : points) {
                for (int i=0; i<4; i++) {
                    Point curr = segments.get(i);
                    Point next = segments.get((i+1)%4);
                    int x1 = curr.x;
                    int y1 = curr.y;
                    int x2 = next.x;
                    int y2 = next.y;
                    if (minDistFromPointToLineSegment(p.x, p.y, x1, y1, x2, y2) < 0.000000001) return true;
                }
            }
            return false;
        }

        int countPointsInside(List<Point> smaller, List<Point> larger) {
            int count = 0;
            for (Point insidePoint : smaller) {
                if (pointInsideSq(insidePoint, larger)) count++;
            }
            return count;
        }

        boolean pointInsideSq(Point p, List<Point> sq) {
            double zero = 0.0000000001;
            Point a = sq.get(0);
            Point b = sq.get(1);
            Point c = sq.get(2);
            Point d = sq.get(3);
            double apd = areaOfTriangle(a, p, d);
            double dpc = areaOfTriangle(d, p, c);
            double cpb = areaOfTriangle(c, p, b);
            double pba = areaOfTriangle(p, b, a);
            double sumOfAreas = apd + dpc + cpb + pba;
            if (sumOfAreas > areaOfSq(sq) + zero) {
                return false;
            } else if (Math.abs(sumOfAreas - areaOfSq(sq)) <= zero) {
                if (apd <= zero || dpc <= zero || cpb <= zero || pba <= zero) {
                    return false;
                }
                return true;
            }
            return false;
        }

        static double minDistFromPointToLineSegment(double point_x, double point_y, double x1, double y1, double x2, double y2) {
            return Math.sqrt(distToSegmentSquared(point_x, point_y, x1, y1, x2, y2));
        }

        static double distToSegmentSquared(double point_x, double point_y, double x1, double y1, double x2, double y2) {
            double l2 = dist2(x1,y1,x2,y2);
            if (l2 == 0) return dist2(point_x, point_y, x1, y1);
            double t = ((point_x - x1) * (x2 - x1) + (point_y - y1) * (y2 - y1)) / l2;
            if (t < 0) return dist2(point_x, point_y, x1, y1);
            if (t > 1) return dist2(point_x, point_y, x2, y2);

            double com_x = x1 + t * (x2 - x1);
            double com_y = y1 + t * (y2 - y1);
            return dist2(point_x, point_y, com_x, com_y);
        }

        static double dist2(double x1, double y1, double x2, double y2) {
            return Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2);
        }

        double areaOfTriangle(Point a, Point b, Point c) {
            return 0.5 * Math.abs((a.x-c.x)*(b.y-a.y)-(a.x-b.x)*(c.y-a.y));
        }

        double areaOfSq(List<Point> sq) {
            int minY = sq.get(0).y;
            int maxY = sq.get(0).x;
            for (Point p : sq) {
                minY = Math.min(minY, p.y);
                maxY = Math.max(maxY, p.y);
            }
            if (sq.get(1).y != sq.get(0).y && sq.get(1).x != sq.get(0).x) {
                // 45 deg
                int halkaisija = maxY - minY;
                return 0.5 * halkaisija * halkaisija;
            } else {
                int side = maxY - minY;
                return 1.0 * side * side;
            }
        }

        /************************** UTILITY CODE BELOW THIS LINE **************************/

        long MOD = (long)1e9 + 7;

        List<Integer>[] toGraph(IO io, int n) {
            List<Integer>[] g = new ArrayList[n+1];
            for (int i=1; i<=n; i++) g[i] = new ArrayList<>();
            for (int i=1; i<=n-1; i++) {
                int a = io.nextInt();
                int b = io.nextInt();
                g[a].add(b);
                g[b].add(a);
            }
            return g;
        }

        class Graph {
            HashMap<Long, List<Long>> edges;

            public Graph() {
                edges = new HashMap<>();
            }

            List<Long> getSetNeighbors(Long node) {
                List<Long> neighbors = edges.get(node);
                if (neighbors == null) {
                    neighbors = new ArrayList<>();
                    edges.put(node, neighbors);
                }
                return neighbors;
            }

            void addBiEdge(Long a, Long b) {
                addEdge(a, b);
                addEdge(b, a);
            }

            void addEdge(Long from, Long to) {
                getSetNeighbors(to); // make sure all have initialized lists
                List<Long> neighbors = getSetNeighbors(from);
                neighbors.add(to);
            }

            // topoSort variables
            int UNTOUCHED = 0;
            int FINISHED = 2;
            int INPROGRESS = 1;
            HashMap<Long, Integer> vis;
            List<Long> topoAns;
            List<Long> failDueToCycle = new ArrayList<Long>() {{ add(-1L); }};

            List<Long> topoSort() {
                topoAns = new ArrayList<>();
                vis = new HashMap<>();
                for (Long a : edges.keySet()) {
                    if (!topoDFS(a)) return failDueToCycle;
                }
                Collections.reverse(topoAns);
                return topoAns;
            }

            boolean topoDFS(long curr) {
                Integer status = vis.get(curr);
                if (status == null) status = UNTOUCHED;
                if (status == FINISHED) return true;
                if (status == INPROGRESS) {
                    return false;
                }
                vis.put(curr, INPROGRESS);
                for (long next : edges.get(curr)) {
                    if (!topoDFS(next)) return false;
                }
                vis.put(curr, FINISHED);
                topoAns.add(curr);
                return true;
            }

        }

        class Point {
            int y;
            int x;

            public Point(int y, int x) {
                this.y = y;
                this.x = x;
            }
        }

        class IDval implements Comparable<IDval> {
            int id;
            long val;

            public IDval(int id, long val) {
                this.val = val;
                this.id = id;
            }

            @Override
            public int compareTo(IDval o) {
                if (this.val < o.val) return -1;
                if (this.val > o.val) return 1;
                return this.id - o.id;
            }
        }

        long pow(long base, int exp) {
            if (exp == 0) return 1L;
            long x = pow(base, exp/2);
            long ans = x * x;
            if (exp % 2 != 0) ans *= base;
            return ans;
        }

        long gcd(long... v) {
            /** Chained calls to Euclidean algorithm. */
            if (v.length == 1) return v[0];
            long ans = gcd(v[1], v[0]);
            for (int i=2; i<v.length; i++) {
                ans = gcd(ans, v[i]);
            }
            return ans;
        }

        long gcd(long a, long b) {
            /** Euclidean algorithm. */
            if (b == 0) return a;
            return gcd(b, a%b);
        }

        int[] generatePrimesUpTo(int last) {
            /* Sieve of Eratosthenes. Practically O(n). Values of 0 indicate primes. */
            int[] div = new int[last+1];
            for (int x=2; x<=last; x++) {
                if (div[x] > 0) continue;
                for (int u=2*x; u<=last; u+=x) {
                    div[u] = x;
                }
            }
            return div;
        }

        long lcm(long a, long b) {
            /** Least common multiple */
            return a * b / gcd(a,b);
        }

        private class ElementCounter {
            private HashMap<Long, Integer> elements;

            public ElementCounter() {
                elements = new HashMap<>();
            }

            public void add(long element) {
                int count = 1;
                Integer prev = elements.get(element);
                if (prev != null) count += prev;
                elements.put(element, count);
            }

            public void remove(long element) {
                int count = elements.remove(element);
                count--;
                if (count > 0) elements.put(element, count);
            }

            public int get(long element) {
                Integer val = elements.get(element);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class StringCounter {
            HashMap<String, Integer> elements;

            public StringCounter() {
                elements = new HashMap<>();
            }

            public void add(String identifier) {
                int count = 1;
                Integer prev = elements.get(identifier);
                if (prev != null) count += prev;
                elements.put(identifier, count);
            }

            public void remove(String identifier) {
                int count = elements.remove(identifier);
                count--;
                if (count > 0) elements.put(identifier, count);
            }

            public long get(String identifier) {
                Integer val = elements.get(identifier);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class DisjointSet {
            /** Union Find / Disjoint Set data structure. */
            int[] size;
            int[] parent;
            int componentCount;

            public DisjointSet(int n) {
                componentCount = n;
                size = new int[n];
                parent = new int[n];
                for (int i=0; i<n; i++) parent[i] = i;
                for (int i=0; i<n; i++) size[i] = 1;
            }

            public void join(int a, int b) {
                /* Find roots */
                int rootA = parent[a];
                int rootB = parent[b];
                while (rootA != parent[rootA]) rootA = parent[rootA];
                while (rootB != parent[rootB]) rootB = parent[rootB];

                if (rootA == rootB) {
                    /* Already in the same set */
                    return;
                }

                /* Merge smaller set into larger set. */
                if (size[rootA] > size[rootB]) {
                    size[rootA] += size[rootB];
                    parent[rootB] = rootA;
                } else {
                    size[rootB] += size[rootA];
                    parent[rootA] = rootB;
                }
                componentCount--;
            }

        }

        class LCAFinder {

            /* O(n log n) Initialize: new LCAFinder(graph)
             * O(log n) Queries: find(a,b) returns lowest common ancestor for nodes a and b */

            int[] nodes;
            int[] depths;
            int[] entries;
            int pointer;
            FenwickMin fenwick;

            public LCAFinder(List<Integer>[] graph) {
                this.nodes = new int[(int)10e6];
                this.depths = new int[(int)10e6];
                this.entries = new int[graph.length];
                this.pointer = 1;
                boolean[] visited = new boolean[graph.length+1];
                dfs(1, 0, graph, visited);
                fenwick = new FenwickMin(pointer-1);
                for (int i=1; i<pointer; i++) {
                    fenwick.set(i, depths[i] * 1000000L + i);
                }
            }

            private void dfs(int node, int depth, List<Integer>[] graph, boolean[] visited) {
                visited[node] = true;
                entries[node] = pointer;
                nodes[pointer] = node;
                depths[pointer] = depth;
                pointer++;
                for (int neighbor : graph[node]) {
                    if (visited[neighbor]) continue;
                    dfs(neighbor, depth+1, graph, visited);
                    nodes[pointer] = node;
                    depths[pointer] = depth;
                    pointer++;
                }
            }

            public int find(int a, int b) {
                int left = entries[a];
                int right = entries[b];
                if (left > right) {
                    int temp = left;
                    left = right;
                    right = temp;
                }
                long mixedBag = fenwick.getMin(left, right);
                int index = (int) (mixedBag % 1000000L);
                return nodes[index];
            }
        }

        class FenwickMin {
            long n;
            long[] original;
            long[] bottomUp;
            long[] topDown;

            public FenwickMin(int n) {
                this.n = n;
                original = new long[n+2];
                bottomUp = new long[n+2];
                topDown = new long[n+2];
            }

            public void set(int modifiedNode, long value) {
                long replaced = original[modifiedNode];
                original[modifiedNode] = value;
                // Update left tree
                int i = modifiedNode;
                long v = value;
                while (i <= n) {
                    if (v > bottomUp[i]) {
                        if (replaced == bottomUp[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i-x;
                                v = Math.min(v, bottomUp[child]);
                            }
                        } else break;
                    }
                    if (v == bottomUp[i]) break;
                    bottomUp[i] = v;
                    i += (i&-i);
                }
                // Update right tree
                i = modifiedNode;
                v = value;
                while (i > 0) {
                    if (v > topDown[i]) {
                        if (replaced == topDown[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i+x;
                                if (child > n+1) break;
                                v = Math.min(v, topDown[child]);
                            }
                        } else break;
                    }
                    if (v == topDown[i]) break;
                    topDown[i] = v;
                    i -= (i&-i);
                }
            }

            public long getMin(int a, int b) {
                long min = original[a];
                int prev = a;
                int curr = prev + (prev&-prev); // parent right hand side
                while (curr <= b) {
                    min = Math.min(min, topDown[prev]); // value from the other tree
                    prev = curr;
                    curr = prev + (prev&-prev);;
                }
                min = Math.min(min, original[prev]);
                prev = b;
                curr = prev - (prev&-prev); // parent left hand side
                while (curr >= a) {
                    min = Math.min(min,bottomUp[prev]); // value from the other tree
                    prev = curr;
                    curr = prev - (prev&-prev);
                }
                return min;
            }

        }

        class FenwickSum {
            public long[] d;

            public FenwickSum(int n) {
                d=new long[n+1];
            }

            /** a[0] must be unused. */
            public FenwickSum(long[] a) {
                d=new long[a.length];
                for (int i=1; i<a.length; i++) {
                    modify(i, a[i]);
                }
            }

            /** Do not modify i=0. */
            void modify(int i, long v) {
                while (i<d.length) {
                    d[i] += v;
                    // Move to next uplink on the RIGHT side of i
                    i += (i&-i);
                }
            }

            /** Returns sum from a to b, *BOTH* inclusive. */
            long getSum(int a, int b) {
                return getSum(b) - getSum(a-1);
            }

            private long getSum(int i) {
                long sum = 0;
                while (i>0) {
                    sum += d[i];
                    // Move to next uplink on the LEFT side of i
                    i -= (i&-i);
                }
                return sum;
            }
        }

        class SegmentTree {
            /** Query sums with log(n) modifyRange */
            int N;
            long[] p;

            public SegmentTree(int n) {
                /* TODO: Test that this works. */
                for (N=2; N<n; N++) N *= 2;
                p = new long[2*N];
            }

            public void modifyRange(int a, int b, long change) {
                muuta(a, change);
                muuta(b+1, -change);
            }

            void muuta(int k, long muutos) {
                k += N;
                p[k] += muutos;
                for (k /= 2; k >= 1; k /= 2) {
                    p[k] = p[2*k] + p[2*k+1];
                }
            }

            public long get(int k) {
                int a = N;
                int b = k+N;
                long s = 0;
                while (a <= b) {
                    if (a%2 == 1) s += p[a++];
                    if (b%2 == 0) s += p[b--];
                    a /= 2;
                    b /= 2;
                }
                return s;
            }

        }

        class Zalgo {

            public int pisinEsiintyma(String haku, String kohde) {
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                int max = 0;
                for (int i=haku.length(); i<z.length; i++) {
                    max = Math.max(max, z[i]);
                }
                return max;
            }

            public int[] toZarray(char[] s) {
                int n = s.length;
                int[] z = new int[n];
                int a = 0, b = 0;
                for (int i = 1; i < n; i++) {
                    if (i > b) {
                        for (int j = i; j < n && s[j - i] == s[j]; j++)  z[i]++;
                    }
                    else {
                        z[i] = z[i - a];
                        if (i + z[i - a] > b) {
                            for (int j = b + 1; j < n && s[j - i] == s[j]; j++) z[i]++;
                            a = i;
                            b = i + z[i] - 1;
                        }
                    }
                }
                return z;
            }

            public List<Integer> getStartIndexesWhereWordIsFound(String haku, String kohde) {
                // this is alternative use case
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                List<Integer> indexes = new ArrayList<>();
                for (int i=haku.length(); i<z.length; i++) {
                    if (z[i] < haku.length()) continue;
                    indexes.add(i);
                }
                return indexes;
            }

        }

        class StringHasher {

            class HashedString {
                long[] hashes;
                long[] modifiers;

                public HashedString(long[] hashes, long[] modifiers) {
                    this.hashes = hashes;
                    this.modifiers = modifiers;
                }
            }

            long P;
            long M;

            public StringHasher() {
                initializePandM();
            }

            HashedString hashString(String s) {
                int n = s.length();
                long[] hashes = new long[n];
                long[] modifiers = new long[n];
                hashes[0] = s.charAt(0);
                modifiers[0] = 1;
                for (int i=1; i<n; i++) {
                    hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    modifiers[i] = (modifiers[i-1] * P) % M;
                }
                return new HashedString(hashes, modifiers);
            }

            /**
             * Indices are inclusive.
             */
            long getHash(HashedString hashedString, int startIndex, int endIndex) {
                long[] hashes = hashedString.hashes;
                long[] modifiers = hashedString.modifiers;
                long result = hashes[endIndex];
                if (startIndex > 0) result -= (hashes[startIndex-1] * modifiers[endIndex-startIndex+1]) % M;
                if (result < 0) result += M;
                return result;
            }

            // Less interesting methods below

            /**
             * Efficient for 2 input parameter strings in particular.
             */
            HashedString[] hashString(String first, String second) {
                HashedString[] array = new HashedString[2];
                int n = first.length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;

                long[] firstHashes = new long[n];
                firstHashes[0] = first.charAt(0);
                array[0] = new HashedString(firstHashes, modifiers);

                long[] secondHashes = new long[n];
                secondHashes[0] = second.charAt(0);
                array[1] = new HashedString(secondHashes, modifiers);

                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    firstHashes[i] = (firstHashes[i-1] * P + first.charAt(i)) % M;
                    secondHashes[i] = (secondHashes[i-1] * P + second.charAt(i)) % M;
                }
                return array;
            }

            /**
             * Efficient for 3+ strings
             * More efficient than multiple hashString calls IF strings are same length.
             */
            HashedString[] hashString(String... strings) {
                HashedString[] array = new HashedString[strings.length];
                int n = strings[0].length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;
                for (int j=0; j<strings.length; j++) {
                    // if all strings are not same length, defer work to another method
                    if (strings[j].length() != n) {
                        for (int i=0; i<n; i++) {
                            array[i] = hashString(strings[i]);
                        }
                        return array;
                    }

                    // otherwise initialize stuff
                    long[] hashes = new long[n];
                    hashes[0] = strings[j].charAt(0);
                    array[j] = new HashedString(hashes, modifiers);
                }
                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    for (int j=0; j<strings.length; j++) {
                        String s = strings[j];
                        long[] hashes = array[j].hashes;
                        hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    }
                }
                return array;
            }

            void initializePandM() {
                ArrayList<Long> modOptions = new ArrayList<>(20);
                modOptions.add(353873237L);
                modOptions.add(353875897L);
                modOptions.add(353878703L);
                modOptions.add(353882671L);
                modOptions.add(353885303L);
                modOptions.add(353888377L);
                modOptions.add(353893457L);
                P = modOptions.get(new Random().nextInt(modOptions.size()));

                modOptions.clear();
                modOptions.add(452940277L);
                modOptions.add(452947687L);
                modOptions.add(464478431L);
                modOptions.add(468098221L);
                modOptions.add(470374601L);
                modOptions.add(472879717L);
                modOptions.add(472881973L);
                M = modOptions.get(new Random().nextInt(modOptions.size()));

            }
        }

        private static class Prob {

            /** For heavy calculations on probabilities, this class
             *  provides more accuracy & efficiency than doubles.
             *  Math explained: https://en.wikipedia.org/wiki/Log_probability
             *  Quick start:
             *      - Instantiate probabilities, eg. Prob a = new Prob(0.75)
             *      - add(), multiply() return new objects, can perform on nulls & NaNs.
             *      - get() returns probability as a readable double */

            /** Logarithmized probability. Note: 0% represented by logP NaN. */
            private double logP;

            /** Construct instance with real probability. */
            public Prob(double real) {
                if (real > 0) this.logP = Math.log(real);
                else this.logP = Double.NaN;
            }

            /** Construct instance with already logarithmized value. */
            static boolean dontLogAgain = true;
            public Prob(double logP, boolean anyBooleanHereToChooseThisConstructor) {
                this.logP = logP;
            }

            /** Returns real probability as a double. */
            public double get() {
                return Math.exp(logP);
            }

            @Override
            public String toString() {
                return ""+get();
            }

            /***************** STATIC METHODS BELOW ********************/

            /** Note: returns NaN only when a && b are both NaN/null. */
            public static Prob add(Prob a, Prob b) {
                if (nullOrNaN(a) && nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                if (nullOrNaN(a)) return copy(b);
                if (nullOrNaN(b)) return copy(a);

                double x = Math.max(a.logP, b.logP);
                double y = Math.min(a.logP, b.logP);
                double sum = x + Math.log(1 + Math.exp(y - x));
                return new Prob(sum, dontLogAgain);
            }

            /** Note: multiplying by null or NaN produces NaN (repping 0% real prob). */
            public static Prob multiply(Prob a, Prob b) {
                if (nullOrNaN(a) || nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                return new Prob(a.logP + b.logP, dontLogAgain);
            }

            /** Returns true if p is null or NaN. */
            private static boolean nullOrNaN(Prob p) {
                return (p == null || Double.isNaN(p.logP));
            }

            /** Returns a new instance with the same value as original. */
            private static Prob copy(Prob original) {
                return new Prob(original.logP, dontLogAgain);
            }
        }

        public class StronglyConnectedComponents {

            /** Kosaraju's algorithm */

            ArrayList<Integer>[] forw;
            ArrayList<Integer>[] bacw;

            /** Use: getCount(2, new int[] {1,2}, new int[] {2,1}) */
            public int getCount(int n, int[] mista, int[] minne) {
                forw = new ArrayList[n+1];
                bacw = new ArrayList[n+1];
                for (int i=1; i<=n; i++) {
                    forw[i] = new ArrayList<Integer>();
                    bacw[i] = new ArrayList<Integer>();
                }
                for (int i=0; i<mista.length; i++) {
                    int a = mista[i];
                    int b = minne[i];
                    forw[a].add(b);
                    bacw[b].add(a);
                }
                int count = 0;
                List<Integer> list = new ArrayList<Integer>();
                boolean[] visited = new boolean[n+1];
                for (int i=1; i<=n; i++) {
                    dfsForward(i, visited, list);
                }
                visited = new boolean[n+1];
                for (int i=n-1; i>=0; i--) {
                    int node = list.get(i);
                    if (visited[node]) continue;
                    count++;
                    dfsBackward(node, visited);
                }
                return count;
            }

            public void dfsForward(int i, boolean[] visited, List<Integer> list) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : forw[i]) {
                    dfsForward(neighbor, visited, list);
                }
                list.add(i);
            }

            public void dfsBackward(int i, boolean[] visited) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : bacw[i]) {
                    dfsBackward(neighbor, visited);
                }
            }
        }

        class DrawGrid {

            void draw(boolean[][] d) {
                System.out.print("  ");
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(" " + x + " ");
                }
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print((d[y][x] ? "[x]" : "[ ]"));
                    }
                    System.out.println("");
                }
            }

            void draw(int[][] d) {
                int max = 1;
                for (int y=0; y<d.length; y++) {
                    for (int x=0; x<d[0].length; x++) {
                        max = Math.max(max, ("" + d[y][x]).length());
                    }
                }
                System.out.print("  ");
                String format = "%" + (max+2) + "s";
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(String.format(format, x) + " ");
                }
                format = "%" + (max) + "s";
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print(" [" + String.format(format, (d[y][x])) + "]");
                    }
                    System.out.println("");
                }
            }

        }

        class BaseConverter {

            /* Palauttaa luvun esityksen kannassa base */
            public String convert(Long number, int base) {
                return Long.toString(number, base);
            }

            /* Palauttaa luvun esityksen kannassa baseTo, kun annetaan luku Stringinä kannassa baseFrom */
            public String convert(String number, int baseFrom, int baseTo) {
                return Long.toString(Long.parseLong(number, baseFrom), baseTo);
            }

            /* Tulkitsee kannassa base esitetyn luvun longiksi (kannassa 10) */
            public long longify(String number, int baseFrom) {
                return Long.parseLong(number, baseFrom);
            }
        }

        class Binary implements Comparable<Binary> {

            /**
             * Use example: Binary b = new Binary(Long.toBinaryString(53249834L));
             *
             * When manipulating small binary strings, instantiate new Binary(string)
             * When just reading large binary strings, instantiate new Binary(string,true)
             * get(int i) returns a character '1' or '0', not an int.
             */

            private boolean[] d;
            private int first; // Starting from left, the first (most remarkable) '1'
            public int length;

            public Binary(String binaryString) {
                this(binaryString, false);
            }
            public Binary(String binaryString, boolean initWithMinArraySize) {
                length = binaryString.length();
                int size = Math.max(2*length, 1);
                first = length/4;
                if (initWithMinArraySize) {
                    first = 0;
                    size = Math.max(length, 1);
                }
                d = new boolean[size];
                for (int i=0; i<length; i++) {
                    if (binaryString.charAt(i) == '1') d[i+first] = true;
                }
            }

            public void addFirst(char c) {
                if (first-1 < 0) doubleArraySize();
                first--;
                d[first] = (c == '1' ? true : false);
                length++;
            }

            public void addLast(char c) {
                if (first+length >= d.length) doubleArraySize();
                d[first+length] = (c == '1' ? true : false);
                length++;
            }

            private void doubleArraySize() {
                boolean[] bigArray = new boolean[(d.length+1) * 2];
                int newFirst = bigArray.length / 4;
                for (int i=0; i<length; i++) {
                    bigArray[i + newFirst] = d[i + first];
                }
                first = newFirst;
                d = bigArray;
            }

            public boolean flip(int i) {
                boolean value = (this.d[first+i] ? false : true);
                this.d[first+i] = value;
                return value;
            }

            public void set(int i, char c) {
                boolean value = (c == '1' ? true : false);
                this.d[first+i] = value;
            }

            public char get(int i) {
                return (this.d[first+i] ? '1' : '0');
            }

            @Override
            public int compareTo(Binary o) {
                if (this.length != o.length) return this.length - o.length;
                int len = this.length;
                for (int i=0; i<len; i++) {
                    int diff = this.get(i) - o.get(i);
                    if (diff != 0) return diff;
                }
                return 0;
            }

            @Override
            public String toString() {
                StringBuilder sb = new StringBuilder();
                for (int i=0; i<length; i++) {
                    sb.append(d[i+first] ? '1' : '0');
                }
                return sb.toString();
            }

        }

        class BinomialCoefficients {
            /** Total number of K sized unique combinations from pool of size N (unordered)
             N! / ( K! (N - K)! )   */

            /** For simple queries where output fits in long. */
            public long biCo(long n, long k) {
                long r = 1;
                if (k > n) return 0;
                for (long d = 1; d <= k; d++) {
                    r *= n--;
                    r /= d;
                }
                return r;
            }

            /** For multiple queries with same n, different k. */
            public long[] precalcBinomialCoefficientsK(int n, int maxK) {
                long v[] = new long[maxK+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,maxK); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                    }
                }
                return v;
            }

            /** When output needs % MOD. */
            public long[] precalcBinomialCoefficientsK(int n, int k, long M) {
                long v[] = new long[k+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,k); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                        v[j] %= M;
                    }
                }
                return v;
            }
        }

        class Trie {
            int N;
            int Z;
            int nextFreeId;
            int[][] pointers;
            boolean[] end;

            /** maxLenSum = maximum possible sum of length of words */
            public Trie(int maxLenSum, int alphabetSize) {
                this.N = maxLenSum;
                this.Z = alphabetSize;
                this.nextFreeId = 1;
                pointers = new int[N+1][alphabetSize];
                end = new boolean[N+1];
            }

            public void addWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) {
                        next = nextFreeId++;
                        pointers[curr][c] = next;
                    }
                    curr = next;
                }
                end[curr] = true;
            }

            public boolean hasWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) return false;
                    curr = next;
                }
                return end[curr];
            }

        }

        private class IO extends PrintWriter {
            private InputStreamReader r;
            private static final int BUFSIZE = 1 << 15;
            private char[] buf;
            private int bufc;
            private int bufi;
            private StringBuilder sb;

            public IO() {
                super(new BufferedOutputStream(System.out));
                r = new InputStreamReader(System.in);

                buf = new char[BUFSIZE];
                bufc = 0;
                bufi = 0;
                sb = new StringBuilder();
            }

            /** Print, flush, return nextInt. */
            private int queryInt(String s) {
                io.println(s);
                io.flush();
                return nextInt();
            }

            /** Print, flush, return nextLong. */
            private long queryLong(String s) {
                io.println(s);
                io.flush();
                return nextLong();
            }

            /** Print, flush, return next word. */
            private String queryNext(String s) {
                io.println(s);
                io.flush();
                return next();
            }

            private void fillBuf() throws IOException {
                bufi = 0;
                bufc = 0;
                while(bufc == 0) {
                    bufc = r.read(buf, 0, BUFSIZE);
                    if(bufc == -1) {
                        bufc = 0;
                        return;
                    }
                }
            }

            private boolean pumpBuf() throws IOException {
                if(bufi == bufc) {
                    fillBuf();
                }
                return bufc != 0;
            }

            private boolean isDelimiter(char c) {
                return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';
            }

            private void eatDelimiters() throws IOException {
                while(true) {
                    if(bufi == bufc) {
                        fillBuf();
                        if(bufc == 0) throw new RuntimeException("IO: Out of input.");
                    }

                    if(!isDelimiter(buf[bufi])) break;
                    ++bufi;
                }
            }

            public String next() {
                try {
                    sb.setLength(0);

                    eatDelimiters();
                    int start = bufi;

                    while(true) {
                        if(bufi == bufc) {
                            sb.append(buf, start, bufi - start);
                            fillBuf();
                            start = 0;
                            if(bufc == 0) break;
                        }

                        if(isDelimiter(buf[bufi])) break;
                        ++bufi;
                    }

                    sb.append(buf, start, bufi - start);

                    return sb.toString();
                } catch(IOException e) {
                    throw new RuntimeException("IO.next: Caught IOException.");
                }
            }

            public int nextInt() {
                try {
                    int ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextInt: Invalid int.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");
                            ret *= 10;
                            ret -= (int)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");
                        } else {
                            throw new RuntimeException("IO.nextInt: Invalid int.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextInt: Caught IOException.");
                }
            }

            public long nextLong() {
                try {
                    long ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextLong: Invalid long.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");
                            ret *= 10;
                            ret -= (long)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");
                        } else {
                            throw new RuntimeException("IO.nextLong: Invalid long.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextLong: Caught IOException.");
                }
            }

            public double nextDouble() {
                return Double.parseDouble(next());
            }

        }

        void print(Object output) {
            io.println(output);
        }

        void done(Object output) {
            print(output);
            done();
        }

        void done() {
            io.close();
            throw new RuntimeException("Clean exit");
        }

        long min(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        double min(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        int min(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        long max(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        double max(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        int max(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

    }

}

//package baobab;

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

public class C {

    public static void main(String[] args) {
        Solver solver = new Solver();
    }

    static class Solver {
        IO io;

        public Solver() {
            this.io = new IO();
            try {
                solve();
            } catch (RuntimeException e) {
                if (!e.getMessage().equals("Clean exit")) {
                    throw e;
                }
            } finally {
                io.close();
            }
        }

        /****************************** START READING HERE ********************************/

        void solve() {
            List<Point> a = new ArrayList<>(4);
            List<Point> b = new ArrayList<>(4);
            for (int i=0; i<4; i++) a.add(new Point(io.nextInt(), io.nextInt()));
            for (int i=0; i<4; i++) b.add(new Point(io.nextInt(), io.nextInt()));
            if (countPointsInside(a,b) >= 1) done("YES");
            if (countPointsInside(b,a) >= 1) done("YES");
            //if (anyPointTouchesAnySegment(a,b)) done("YES");
            //if (anyPointTouchesAnySegment(b,a)) done("YES");
            if (anySegFromATouchesAnySegFromB(a,b)) done("YES");
            io.println("NO");
        }

        boolean anySegFromATouchesAnySegFromB(List<Point> a, List<Point> b) {
            for (int i=0; i<a.size(); i++) {
                Point curr = a.get(i);
                Point next = a.get((i+1)%a.size());
                double x1 = curr.x;
                double y1 = curr.y;
                double x2 = next.x;
                double y2 = next.y;
                for (int j=0; j<b.size(); j++) {
                    curr = b.get(j);
                    next = b.get((j+1)%b.size());
                    double x3 = curr.x;
                    double y3 = curr.y;
                    double x4 = next.x;
                    double y4 = next.y;
                    if (segmentsIntersect(x1, y1, x2, y2, x3, y3, x4, y4)) {
                        return true;
                    }
                }
            }
            return false;
        }

        // Returns true if segment 1-2 intersects segment 3-4
        boolean segmentsIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
            if (max(x1,x2) < min(x3,x4)) {
                // Segments do not have mutual x coordinates
                return false;
            }
            if (x1 == x2 && x3 == x4) {
                // Both segments are vertical
                if (x1 != x3) return false;
                if (min(y1,y2) < min(y3,y4)) {
                    return max(y1,y2) >= min(y3,y4);
                } else {
                    return max(y3,y4) >= min(y1,y2);
                }
            }
            if (x1 == x2) {
                // Only segment 1-2 is vertical. Does segment 3-4 cross it? y = a*x + b
                double a34 = (y4-y3)/(x4-x3);
                double b34 = y3 - a34*x3;
                double y = a34 * x1 + b34;
                return y >= min(y1,y2) && y <= max(y1,y2);
            }
            if (x3 == x4) {
                // Only segment 3-4 is vertical. Does segment 1-2 cross it? y = a*x + b
                double a12 = (y2-y1)/(x2-x1);
                double b12 = y1 - a12*x1;
                double y = a12 * x3 + b12;
                return y >= min(y3,y4) && y <= max(y3,y4);
            }
            double a12 = (y2-y1)/(x2-x1);
            double b12 = y1 - a12*x1;
            double a34 = (y4-y3)/(x4-x3);
            double b34 = y3 - a34*x3;
            if (closeToZero(a12 - a34)) {
                // Parallel lines
                return closeToZero(b12 - b34);
            }
            // Non parallel non vertical lines intersect at x. Is x part of both segments?
            double x = -(b12-b34)/(a12-a34);
            return x >= min(x1,x2) && x <= max(x1,x2) && x >= min(x3,x4) && x <= max(x3,x4);
        }

        boolean anyPointTouchesAnySegment(List<Point> points, List<Point> segments) {
            for (Point p : points) {
                for (int i=0; i<4; i++) {
                    Point curr = segments.get(i);
                    Point next = segments.get((i+1)%4);
                    int x1 = curr.x;
                    int y1 = curr.y;
                    int x2 = next.x;
                    int y2 = next.y;
                    if (minDistFromPointToLineSegment(p.x, p.y, x1, y1, x2, y2) < 0.000000001) return true;
                }
            }
            return false;
        }

        int countPointsInside(List<Point> smaller, List<Point> larger) {
            int count = 0;
            for (Point insidePoint : smaller) {
                if (pointInsideRectangle(insidePoint, larger)) count++;
            }
            return count;
        }

        boolean closeToZero(double v) {
            return Math.abs(v) <= 0.0000000000001;
        }

        boolean pointInsideRectangle(Point p, List<Point> r) {
            Point a = r.get(0);
            Point b = r.get(1);
            Point c = r.get(2);
            Point d = r.get(3);
            double apd = areaOfTriangle(a, p, d);
            double dpc = areaOfTriangle(d, p, c);
            double cpb = areaOfTriangle(c, p, b);
            double pba = areaOfTriangle(p, b, a);
            double sumOfAreas = apd + dpc + cpb + pba;
            if (closeToZero(sumOfAreas - areaOfRectangle(r))) {
                if (closeToZero(apd) || closeToZero(dpc) || closeToZero(cpb) || closeToZero(pba)) {
                    return false;
                }
                return true;
            }
            return false;
        }

        boolean arePointsOnSameLine(double x1, double y1, double x2, double y2, double x3, double y3) {
            double areaTimes2 = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
            return (closeToZero(areaTimes2));
        }

        double minDistFromPointToLineSegment(double point_x, double point_y, double x1, double y1, double x2, double y2) {
            return Math.sqrt(distToSegmentSquared(point_x, point_y, x1, y1, x2, y2));
        }

        double distToSegmentSquared(double point_x, double point_y, double x1, double y1, double x2, double y2) {
            double l2 = dist2(x1,y1,x2,y2);
            if (l2 == 0) return dist2(point_x, point_y, x1, y1);
            double t = ((point_x - x1) * (x2 - x1) + (point_y - y1) * (y2 - y1)) / l2;
            if (t < 0) return dist2(point_x, point_y, x1, y1);
            if (t > 1) return dist2(point_x, point_y, x2, y2);

            double com_x = x1 + t * (x2 - x1);
            double com_y = y1 + t * (y2 - y1);
            return dist2(point_x, point_y, com_x, com_y);
        }

        double dist2(double x1, double y1, double x2, double y2) {
            return Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2);
        }

        double areaOfTriangle(Point a, Point b, Point c) {
            return 0.5 * Math.abs((a.x-c.x)*(b.y-a.y)-(a.x-b.x)*(c.y-a.y));
        }

        double areaOfRectangle(List<Point> sq) {
            double side1xDiff = sq.get(0).x - sq.get(1).x;
            double side1yDiff = sq.get(0).y - sq.get(1).y;
            double side2xDiff = sq.get(1).x - sq.get(2).x;
            double side2yDiff = sq.get(1).y - sq.get(2).y;
            double side1 = Math.sqrt(side1xDiff * side1xDiff + side1yDiff * side1yDiff);
            double side2 = Math.sqrt(side2xDiff * side2xDiff + side2yDiff * side2yDiff);
            return side1 * side2;
        }

        /************************** UTILITY CODE BELOW THIS LINE **************************/

        long MOD = (long)1e9 + 7;

        List<Integer>[] toGraph(IO io, int n) {
            List<Integer>[] g = new ArrayList[n+1];
            for (int i=1; i<=n; i++) g[i] = new ArrayList<>();
            for (int i=1; i<=n-1; i++) {
                int a = io.nextInt();
                int b = io.nextInt();
                g[a].add(b);
                g[b].add(a);
            }
            return g;
        }

        class Graph {
            HashMap<Long, List<Long>> edges;

            public Graph() {
                edges = new HashMap<>();
            }

            List<Long> getSetNeighbors(Long node) {
                List<Long> neighbors = edges.get(node);
                if (neighbors == null) {
                    neighbors = new ArrayList<>();
                    edges.put(node, neighbors);
                }
                return neighbors;
            }

            void addBiEdge(Long a, Long b) {
                addEdge(a, b);
                addEdge(b, a);
            }

            void addEdge(Long from, Long to) {
                getSetNeighbors(to); // make sure all have initialized lists
                List<Long> neighbors = getSetNeighbors(from);
                neighbors.add(to);
            }

            // topoSort variables
            int UNTOUCHED = 0;
            int FINISHED = 2;
            int INPROGRESS = 1;
            HashMap<Long, Integer> vis;
            List<Long> topoAns;
            List<Long> failDueToCycle = new ArrayList<Long>() {{ add(-1L); }};

            List<Long> topoSort() {
                topoAns = new ArrayList<>();
                vis = new HashMap<>();
                for (Long a : edges.keySet()) {
                    if (!topoDFS(a)) return failDueToCycle;
                }
                Collections.reverse(topoAns);
                return topoAns;
            }

            boolean topoDFS(long curr) {
                Integer status = vis.get(curr);
                if (status == null) status = UNTOUCHED;
                if (status == FINISHED) return true;
                if (status == INPROGRESS) {
                    return false;
                }
                vis.put(curr, INPROGRESS);
                for (long next : edges.get(curr)) {
                    if (!topoDFS(next)) return false;
                }
                vis.put(curr, FINISHED);
                topoAns.add(curr);
                return true;
            }

        }

        class Point {
            int y;
            int x;

            public Point(int x, int y) {
                this.y = y;
                this.x = x;
            }
        }

        class IDval implements Comparable<IDval> {
            int id;
            long val;

            public IDval(int id, long val) {
                this.val = val;
                this.id = id;
            }

            @Override
            public int compareTo(IDval o) {
                if (this.val < o.val) return -1;
                if (this.val > o.val) return 1;
                return this.id - o.id;
            }
        }

        long pow(long base, int exp) {
            if (exp == 0) return 1L;
            long x = pow(base, exp/2);
            long ans = x * x;
            if (exp % 2 != 0) ans *= base;
            return ans;
        }

        long gcd(long... v) {
            /** Chained calls to Euclidean algorithm. */
            if (v.length == 1) return v[0];
            long ans = gcd(v[1], v[0]);
            for (int i=2; i<v.length; i++) {
                ans = gcd(ans, v[i]);
            }
            return ans;
        }

        long gcd(long a, long b) {
            /** Euclidean algorithm. */
            if (b == 0) return a;
            return gcd(b, a%b);
        }

        int[] generatePrimesUpTo(int last) {
            /* Sieve of Eratosthenes. Practically O(n). Values of 0 indicate primes. */
            int[] div = new int[last+1];
            for (int x=2; x<=last; x++) {
                if (div[x] > 0) continue;
                for (int u=2*x; u<=last; u+=x) {
                    div[u] = x;
                }
            }
            return div;
        }

        long lcm(long a, long b) {
            /** Least common multiple */
            return a * b / gcd(a,b);
        }

        private class ElementCounter {
            private HashMap<Long, Integer> elements;

            public ElementCounter() {
                elements = new HashMap<>();
            }

            public void add(long element) {
                int count = 1;
                Integer prev = elements.get(element);
                if (prev != null) count += prev;
                elements.put(element, count);
            }

            public void remove(long element) {
                int count = elements.remove(element);
                count--;
                if (count > 0) elements.put(element, count);
            }

            public int get(long element) {
                Integer val = elements.get(element);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class StringCounter {
            HashMap<String, Integer> elements;

            public StringCounter() {
                elements = new HashMap<>();
            }

            public void add(String identifier) {
                int count = 1;
                Integer prev = elements.get(identifier);
                if (prev != null) count += prev;
                elements.put(identifier, count);
            }

            public void remove(String identifier) {
                int count = elements.remove(identifier);
                count--;
                if (count > 0) elements.put(identifier, count);
            }

            public long get(String identifier) {
                Integer val = elements.get(identifier);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class DisjointSet {
            /** Union Find / Disjoint Set data structure. */
            int[] size;
            int[] parent;
            int componentCount;

            public DisjointSet(int n) {
                componentCount = n;
                size = new int[n];
                parent = new int[n];
                for (int i=0; i<n; i++) parent[i] = i;
                for (int i=0; i<n; i++) size[i] = 1;
            }

            public void join(int a, int b) {
                /* Find roots */
                int rootA = parent[a];
                int rootB = parent[b];
                while (rootA != parent[rootA]) rootA = parent[rootA];
                while (rootB != parent[rootB]) rootB = parent[rootB];

                if (rootA == rootB) {
                    /* Already in the same set */
                    return;
                }

                /* Merge smaller set into larger set. */
                if (size[rootA] > size[rootB]) {
                    size[rootA] += size[rootB];
                    parent[rootB] = rootA;
                } else {
                    size[rootB] += size[rootA];
                    parent[rootA] = rootB;
                }
                componentCount--;
            }

        }

        class LCAFinder {

            /* O(n log n) Initialize: new LCAFinder(graph)
             * O(log n) Queries: find(a,b) returns lowest common ancestor for nodes a and b */

            int[] nodes;
            int[] depths;
            int[] entries;
            int pointer;
            FenwickMin fenwick;

            public LCAFinder(List<Integer>[] graph) {
                this.nodes = new int[(int)10e6];
                this.depths = new int[(int)10e6];
                this.entries = new int[graph.length];
                this.pointer = 1;
                boolean[] visited = new boolean[graph.length+1];
                dfs(1, 0, graph, visited);
                fenwick = new FenwickMin(pointer-1);
                for (int i=1; i<pointer; i++) {
                    fenwick.set(i, depths[i] * 1000000L + i);
                }
            }

            private void dfs(int node, int depth, List<Integer>[] graph, boolean[] visited) {
                visited[node] = true;
                entries[node] = pointer;
                nodes[pointer] = node;
                depths[pointer] = depth;
                pointer++;
                for (int neighbor : graph[node]) {
                    if (visited[neighbor]) continue;
                    dfs(neighbor, depth+1, graph, visited);
                    nodes[pointer] = node;
                    depths[pointer] = depth;
                    pointer++;
                }
            }

            public int find(int a, int b) {
                int left = entries[a];
                int right = entries[b];
                if (left > right) {
                    int temp = left;
                    left = right;
                    right = temp;
                }
                long mixedBag = fenwick.getMin(left, right);
                int index = (int) (mixedBag % 1000000L);
                return nodes[index];
            }
        }

        class FenwickMin {
            long n;
            long[] original;
            long[] bottomUp;
            long[] topDown;

            public FenwickMin(int n) {
                this.n = n;
                original = new long[n+2];
                bottomUp = new long[n+2];
                topDown = new long[n+2];
            }

            public void set(int modifiedNode, long value) {
                long replaced = original[modifiedNode];
                original[modifiedNode] = value;
                // Update left tree
                int i = modifiedNode;
                long v = value;
                while (i <= n) {
                    if (v > bottomUp[i]) {
                        if (replaced == bottomUp[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i-x;
                                v = Math.min(v, bottomUp[child]);
                            }
                        } else break;
                    }
                    if (v == bottomUp[i]) break;
                    bottomUp[i] = v;
                    i += (i&-i);
                }
                // Update right tree
                i = modifiedNode;
                v = value;
                while (i > 0) {
                    if (v > topDown[i]) {
                        if (replaced == topDown[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i+x;
                                if (child > n+1) break;
                                v = Math.min(v, topDown[child]);
                            }
                        } else break;
                    }
                    if (v == topDown[i]) break;
                    topDown[i] = v;
                    i -= (i&-i);
                }
            }

            public long getMin(int a, int b) {
                long min = original[a];
                int prev = a;
                int curr = prev + (prev&-prev); // parent right hand side
                while (curr <= b) {
                    min = Math.min(min, topDown[prev]); // value from the other tree
                    prev = curr;
                    curr = prev + (prev&-prev);;
                }
                min = Math.min(min, original[prev]);
                prev = b;
                curr = prev - (prev&-prev); // parent left hand side
                while (curr >= a) {
                    min = Math.min(min,bottomUp[prev]); // value from the other tree
                    prev = curr;
                    curr = prev - (prev&-prev);
                }
                return min;
            }

        }

        class FenwickSum {
            public long[] d;

            public FenwickSum(int n) {
                d=new long[n+1];
            }

            /** a[0] must be unused. */
            public FenwickSum(long[] a) {
                d=new long[a.length];
                for (int i=1; i<a.length; i++) {
                    modify(i, a[i]);
                }
            }

            /** Do not modify i=0. */
            void modify(int i, long v) {
                while (i<d.length) {
                    d[i] += v;
                    // Move to next uplink on the RIGHT side of i
                    i += (i&-i);
                }
            }

            /** Returns sum from a to b, *BOTH* inclusive. */
            long getSum(int a, int b) {
                return getSum(b) - getSum(a-1);
            }

            private long getSum(int i) {
                long sum = 0;
                while (i>0) {
                    sum += d[i];
                    // Move to next uplink on the LEFT side of i
                    i -= (i&-i);
                }
                return sum;
            }
        }

        class SegmentTree {
            /** Query sums with log(n) modifyRange */
            int N;
            long[] p;

            public SegmentTree(int n) {
                /* TODO: Test that this works. */
                for (N=2; N<n; N++) N *= 2;
                p = new long[2*N];
            }

            public void modifyRange(int a, int b, long change) {
                muuta(a, change);
                muuta(b+1, -change);
            }

            void muuta(int k, long muutos) {
                k += N;
                p[k] += muutos;
                for (k /= 2; k >= 1; k /= 2) {
                    p[k] = p[2*k] + p[2*k+1];
                }
            }

            public long get(int k) {
                int a = N;
                int b = k+N;
                long s = 0;
                while (a <= b) {
                    if (a%2 == 1) s += p[a++];
                    if (b%2 == 0) s += p[b--];
                    a /= 2;
                    b /= 2;
                }
                return s;
            }

        }

        class Zalgo {

            public int pisinEsiintyma(String haku, String kohde) {
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                int max = 0;
                for (int i=haku.length(); i<z.length; i++) {
                    max = Math.max(max, z[i]);
                }
                return max;
            }

            public int[] toZarray(char[] s) {
                int n = s.length;
                int[] z = new int[n];
                int a = 0, b = 0;
                for (int i = 1; i < n; i++) {
                    if (i > b) {
                        for (int j = i; j < n && s[j - i] == s[j]; j++)  z[i]++;
                    }
                    else {
                        z[i] = z[i - a];
                        if (i + z[i - a] > b) {
                            for (int j = b + 1; j < n && s[j - i] == s[j]; j++) z[i]++;
                            a = i;
                            b = i + z[i] - 1;
                        }
                    }
                }
                return z;
            }

            public List<Integer> getStartIndexesWhereWordIsFound(String haku, String kohde) {
                // this is alternative use case
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                List<Integer> indexes = new ArrayList<>();
                for (int i=haku.length(); i<z.length; i++) {
                    if (z[i] < haku.length()) continue;
                    indexes.add(i);
                }
                return indexes;
            }

        }

        class StringHasher {

            class HashedString {
                long[] hashes;
                long[] modifiers;

                public HashedString(long[] hashes, long[] modifiers) {
                    this.hashes = hashes;
                    this.modifiers = modifiers;
                }
            }

            long P;
            long M;

            public StringHasher() {
                initializePandM();
            }

            HashedString hashString(String s) {
                int n = s.length();
                long[] hashes = new long[n];
                long[] modifiers = new long[n];
                hashes[0] = s.charAt(0);
                modifiers[0] = 1;
                for (int i=1; i<n; i++) {
                    hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    modifiers[i] = (modifiers[i-1] * P) % M;
                }
                return new HashedString(hashes, modifiers);
            }

            /**
             * Indices are inclusive.
             */
            long getHash(HashedString hashedString, int startIndex, int endIndex) {
                long[] hashes = hashedString.hashes;
                long[] modifiers = hashedString.modifiers;
                long result = hashes[endIndex];
                if (startIndex > 0) result -= (hashes[startIndex-1] * modifiers[endIndex-startIndex+1]) % M;
                if (result < 0) result += M;
                return result;
            }

            // Less interesting methods below

            /**
             * Efficient for 2 input parameter strings in particular.
             */
            HashedString[] hashString(String first, String second) {
                HashedString[] array = new HashedString[2];
                int n = first.length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;

                long[] firstHashes = new long[n];
                firstHashes[0] = first.charAt(0);
                array[0] = new HashedString(firstHashes, modifiers);

                long[] secondHashes = new long[n];
                secondHashes[0] = second.charAt(0);
                array[1] = new HashedString(secondHashes, modifiers);

                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    firstHashes[i] = (firstHashes[i-1] * P + first.charAt(i)) % M;
                    secondHashes[i] = (secondHashes[i-1] * P + second.charAt(i)) % M;
                }
                return array;
            }

            /**
             * Efficient for 3+ strings
             * More efficient than multiple hashString calls IF strings are same length.
             */
            HashedString[] hashString(String... strings) {
                HashedString[] array = new HashedString[strings.length];
                int n = strings[0].length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;
                for (int j=0; j<strings.length; j++) {
                    // if all strings are not same length, defer work to another method
                    if (strings[j].length() != n) {
                        for (int i=0; i<n; i++) {
                            array[i] = hashString(strings[i]);
                        }
                        return array;
                    }

                    // otherwise initialize stuff
                    long[] hashes = new long[n];
                    hashes[0] = strings[j].charAt(0);
                    array[j] = new HashedString(hashes, modifiers);
                }
                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    for (int j=0; j<strings.length; j++) {
                        String s = strings[j];
                        long[] hashes = array[j].hashes;
                        hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    }
                }
                return array;
            }

            void initializePandM() {
                ArrayList<Long> modOptions = new ArrayList<>(20);
                modOptions.add(353873237L);
                modOptions.add(353875897L);
                modOptions.add(353878703L);
                modOptions.add(353882671L);
                modOptions.add(353885303L);
                modOptions.add(353888377L);
                modOptions.add(353893457L);
                P = modOptions.get(new Random().nextInt(modOptions.size()));

                modOptions.clear();
                modOptions.add(452940277L);
                modOptions.add(452947687L);
                modOptions.add(464478431L);
                modOptions.add(468098221L);
                modOptions.add(470374601L);
                modOptions.add(472879717L);
                modOptions.add(472881973L);
                M = modOptions.get(new Random().nextInt(modOptions.size()));

            }
        }

        private static class Prob {

            /** For heavy calculations on probabilities, this class
             *  provides more accuracy & efficiency than doubles.
             *  Math explained: https://en.wikipedia.org/wiki/Log_probability
             *  Quick start:
             *      - Instantiate probabilities, eg. Prob a = new Prob(0.75)
             *      - add(), multiply() return new objects, can perform on nulls & NaNs.
             *      - get() returns probability as a readable double */

            /** Logarithmized probability. Note: 0% represented by logP NaN. */
            private double logP;

            /** Construct instance with real probability. */
            public Prob(double real) {
                if (real > 0) this.logP = Math.log(real);
                else this.logP = Double.NaN;
            }

            /** Construct instance with already logarithmized value. */
            static boolean dontLogAgain = true;
            public Prob(double logP, boolean anyBooleanHereToChooseThisConstructor) {
                this.logP = logP;
            }

            /** Returns real probability as a double. */
            public double get() {
                return Math.exp(logP);
            }

            @Override
            public String toString() {
                return ""+get();
            }

            /***************** STATIC METHODS BELOW ********************/

            /** Note: returns NaN only when a && b are both NaN/null. */
            public static Prob add(Prob a, Prob b) {
                if (nullOrNaN(a) && nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                if (nullOrNaN(a)) return copy(b);
                if (nullOrNaN(b)) return copy(a);

                double x = Math.max(a.logP, b.logP);
                double y = Math.min(a.logP, b.logP);
                double sum = x + Math.log(1 + Math.exp(y - x));
                return new Prob(sum, dontLogAgain);
            }

            /** Note: multiplying by null or NaN produces NaN (repping 0% real prob). */
            public static Prob multiply(Prob a, Prob b) {
                if (nullOrNaN(a) || nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                return new Prob(a.logP + b.logP, dontLogAgain);
            }

            /** Returns true if p is null or NaN. */
            private static boolean nullOrNaN(Prob p) {
                return (p == null || Double.isNaN(p.logP));
            }

            /** Returns a new instance with the same value as original. */
            private static Prob copy(Prob original) {
                return new Prob(original.logP, dontLogAgain);
            }
        }

        public class StronglyConnectedComponents {

            /** Kosaraju's algorithm */

            ArrayList<Integer>[] forw;
            ArrayList<Integer>[] bacw;

            /** Use: getCount(2, new int[] {1,2}, new int[] {2,1}) */
            public int getCount(int n, int[] mista, int[] minne) {
                forw = new ArrayList[n+1];
                bacw = new ArrayList[n+1];
                for (int i=1; i<=n; i++) {
                    forw[i] = new ArrayList<Integer>();
                    bacw[i] = new ArrayList<Integer>();
                }
                for (int i=0; i<mista.length; i++) {
                    int a = mista[i];
                    int b = minne[i];
                    forw[a].add(b);
                    bacw[b].add(a);
                }
                int count = 0;
                List<Integer> list = new ArrayList<Integer>();
                boolean[] visited = new boolean[n+1];
                for (int i=1; i<=n; i++) {
                    dfsForward(i, visited, list);
                }
                visited = new boolean[n+1];
                for (int i=n-1; i>=0; i--) {
                    int node = list.get(i);
                    if (visited[node]) continue;
                    count++;
                    dfsBackward(node, visited);
                }
                return count;
            }

            public void dfsForward(int i, boolean[] visited, List<Integer> list) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : forw[i]) {
                    dfsForward(neighbor, visited, list);
                }
                list.add(i);
            }

            public void dfsBackward(int i, boolean[] visited) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : bacw[i]) {
                    dfsBackward(neighbor, visited);
                }
            }
        }

        class DrawGrid {

            void draw(boolean[][] d) {
                System.out.print("  ");
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(" " + x + " ");
                }
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print((d[y][x] ? "[x]" : "[ ]"));
                    }
                    System.out.println("");
                }
            }

            void draw(int[][] d) {
                int max = 1;
                for (int y=0; y<d.length; y++) {
                    for (int x=0; x<d[0].length; x++) {
                        max = Math.max(max, ("" + d[y][x]).length());
                    }
                }
                System.out.print("  ");
                String format = "%" + (max+2) + "s";
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(String.format(format, x) + " ");
                }
                format = "%" + (max) + "s";
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print(" [" + String.format(format, (d[y][x])) + "]");
                    }
                    System.out.println("");
                }
            }

        }

        class BaseConverter {

            /* Palauttaa luvun esityksen kannassa base */
            public String convert(Long number, int base) {
                return Long.toString(number, base);
            }

            /* Palauttaa luvun esityksen kannassa baseTo, kun annetaan luku Stringinä kannassa baseFrom */
            public String convert(String number, int baseFrom, int baseTo) {
                return Long.toString(Long.parseLong(number, baseFrom), baseTo);
            }

            /* Tulkitsee kannassa base esitetyn luvun longiksi (kannassa 10) */
            public long longify(String number, int baseFrom) {
                return Long.parseLong(number, baseFrom);
            }
        }

        class Binary implements Comparable<Binary> {

            /**
             * Use example: Binary b = new Binary(Long.toBinaryString(53249834L));
             *
             * When manipulating small binary strings, instantiate new Binary(string)
             * When just reading large binary strings, instantiate new Binary(string,true)
             * get(int i) returns a character '1' or '0', not an int.
             */

            private boolean[] d;
            private int first; // Starting from left, the first (most remarkable) '1'
            public int length;

            public Binary(String binaryString) {
                this(binaryString, false);
            }
            public Binary(String binaryString, boolean initWithMinArraySize) {
                length = binaryString.length();
                int size = Math.max(2*length, 1);
                first = length/4;
                if (initWithMinArraySize) {
                    first = 0;
                    size = Math.max(length, 1);
                }
                d = new boolean[size];
                for (int i=0; i<length; i++) {
                    if (binaryString.charAt(i) == '1') d[i+first] = true;
                }
            }

            public void addFirst(char c) {
                if (first-1 < 0) doubleArraySize();
                first--;
                d[first] = (c == '1' ? true : false);
                length++;
            }

            public void addLast(char c) {
                if (first+length >= d.length) doubleArraySize();
                d[first+length] = (c == '1' ? true : false);
                length++;
            }

            private void doubleArraySize() {
                boolean[] bigArray = new boolean[(d.length+1) * 2];
                int newFirst = bigArray.length / 4;
                for (int i=0; i<length; i++) {
                    bigArray[i + newFirst] = d[i + first];
                }
                first = newFirst;
                d = bigArray;
            }

            public boolean flip(int i) {
                boolean value = (this.d[first+i] ? false : true);
                this.d[first+i] = value;
                return value;
            }

            public void set(int i, char c) {
                boolean value = (c == '1' ? true : false);
                this.d[first+i] = value;
            }

            public char get(int i) {
                return (this.d[first+i] ? '1' : '0');
            }

            @Override
            public int compareTo(Binary o) {
                if (this.length != o.length) return this.length - o.length;
                int len = this.length;
                for (int i=0; i<len; i++) {
                    int diff = this.get(i) - o.get(i);
                    if (diff != 0) return diff;
                }
                return 0;
            }

            @Override
            public String toString() {
                StringBuilder sb = new StringBuilder();
                for (int i=0; i<length; i++) {
                    sb.append(d[i+first] ? '1' : '0');
                }
                return sb.toString();
            }

        }

        class BinomialCoefficients {
            /** Total number of K sized unique combinations from pool of size N (unordered)
             N! / ( K! (N - K)! )   */

            /** For simple queries where output fits in long. */
            public long biCo(long n, long k) {
                long r = 1;
                if (k > n) return 0;
                for (long d = 1; d <= k; d++) {
                    r *= n--;
                    r /= d;
                }
                return r;
            }

            /** For multiple queries with same n, different k. */
            public long[] precalcBinomialCoefficientsK(int n, int maxK) {
                long v[] = new long[maxK+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,maxK); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                    }
                }
                return v;
            }

            /** When output needs % MOD. */
            public long[] precalcBinomialCoefficientsK(int n, int k, long M) {
                long v[] = new long[k+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,k); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                        v[j] %= M;
                    }
                }
                return v;
            }
        }

        class Trie {
            int N;
            int Z;
            int nextFreeId;
            int[][] pointers;
            boolean[] end;

            /** maxLenSum = maximum possible sum of length of words */
            public Trie(int maxLenSum, int alphabetSize) {
                this.N = maxLenSum;
                this.Z = alphabetSize;
                this.nextFreeId = 1;
                pointers = new int[N+1][alphabetSize];
                end = new boolean[N+1];
            }

            public void addWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) {
                        next = nextFreeId++;
                        pointers[curr][c] = next;
                    }
                    curr = next;
                }
                end[curr] = true;
            }

            public boolean hasWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) return false;
                    curr = next;
                }
                return end[curr];
            }

        }

        private class IO extends PrintWriter {
            private InputStreamReader r;
            private static final int BUFSIZE = 1 << 15;
            private char[] buf;
            private int bufc;
            private int bufi;
            private StringBuilder sb;

            public IO() {
                super(new BufferedOutputStream(System.out));
                r = new InputStreamReader(System.in);

                buf = new char[BUFSIZE];
                bufc = 0;
                bufi = 0;
                sb = new StringBuilder();
            }

            /** Print, flush, return nextInt. */
            private int queryInt(String s) {
                io.println(s);
                io.flush();
                return nextInt();
            }

            /** Print, flush, return nextLong. */
            private long queryLong(String s) {
                io.println(s);
                io.flush();
                return nextLong();
            }

            /** Print, flush, return next word. */
            private String queryNext(String s) {
                io.println(s);
                io.flush();
                return next();
            }

            private void fillBuf() throws IOException {
                bufi = 0;
                bufc = 0;
                while(bufc == 0) {
                    bufc = r.read(buf, 0, BUFSIZE);
                    if(bufc == -1) {
                        bufc = 0;
                        return;
                    }
                }
            }

            private boolean pumpBuf() throws IOException {
                if(bufi == bufc) {
                    fillBuf();
                }
                return bufc != 0;
            }

            private boolean isDelimiter(char c) {
                return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';
            }

            private void eatDelimiters() throws IOException {
                while(true) {
                    if(bufi == bufc) {
                        fillBuf();
                        if(bufc == 0) throw new RuntimeException("IO: Out of input.");
                    }

                    if(!isDelimiter(buf[bufi])) break;
                    ++bufi;
                }
            }

            public String next() {
                try {
                    sb.setLength(0);

                    eatDelimiters();
                    int start = bufi;

                    while(true) {
                        if(bufi == bufc) {
                            sb.append(buf, start, bufi - start);
                            fillBuf();
                            start = 0;
                            if(bufc == 0) break;
                        }

                        if(isDelimiter(buf[bufi])) break;
                        ++bufi;
                    }

                    sb.append(buf, start, bufi - start);

                    return sb.toString();
                } catch(IOException e) {
                    throw new RuntimeException("IO.next: Caught IOException.");
                }
            }

            public int nextInt() {
                try {
                    int ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextInt: Invalid int.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");
                            ret *= 10;
                            ret -= (int)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");
                        } else {
                            throw new RuntimeException("IO.nextInt: Invalid int.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextInt: Caught IOException.");
                }
            }

            public long nextLong() {
                try {
                    long ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextLong: Invalid long.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");
                            ret *= 10;
                            ret -= (long)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");
                        } else {
                            throw new RuntimeException("IO.nextLong: Invalid long.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextLong: Caught IOException.");
                }
            }

            public double nextDouble() {
                return Double.parseDouble(next());
            }

        }

        void print(Object output) {
            io.println(output);
        }

        void done(Object output) {
            print(output);
            done();
        }

        void done() {
            io.close();
            throw new RuntimeException("Clean exit");
        }

        long min(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        double min(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        int min(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        long max(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        double max(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        int max(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            Polygon p1 = new Polygon();
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            p1.addPoint(in.nextInt(), in.nextInt());
            Rectangle r = p1.getBounds();
            Polygon p2 = new Polygon();
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            p2.addPoint(in.nextInt(), in.nextInt());
            boolean inside = p2.intersects(r);
            boolean point1 = false;
            for (int i = 0; i < p1.npoints; i++) {
                point1 |= p2.contains(p1.xpoints[i], p1.xpoints[i]);
            }
            boolean point2 = false;
            for (int i = 0; i < p2.npoints; i++) {
                point2 |= p1.contains(p2.xpoints[i], p2.xpoints[i]);
            }
            out.println((inside || point1 || point2) ? "YES" : "NO");
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.*;
import java.lang.Math.*;

public class Solution{

    static int[] n = new int[2];

    public static String solve(int[][] a, int[][] b) {
        if(check(a, b, n)){return "YES";}
        else{return "NO";}
    }

    private static Boolean check(int[][] a, int[][] b, int[] n){
        for(int i=-100;i<100;i++){
            for(int j=-100;j<100;j++){
                int[] p = new int[]{i,j};
                if(i<=a[1][0]&&i>=a[0][0]&&j<=a[2][1]&&j>=a[0][1]&&dist(p,n)<dist(a[0],n)){
                    return true;
                }
            }
        }
        return false;
    }

    private static double dist(int[] a, int[] b){
        return Math.sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));
    }

    private static int[][] transforma(int[][] a){
        int[] x_axis=new int[4];
        int[] y_axis=new int[4];
        int[][] square = new int[4][2];

        for(int i=0;i<4;i++){
            x_axis[i] = a[i][0];
            y_axis[i] = a[i][1];
        }

        int[] A= new int[]{getMin(x_axis), getMin(y_axis)};
        int[] B= new int[]{getMax(x_axis), getMin(y_axis)};
        int[] C= new int[]{getMax(x_axis), getMax(y_axis)};
        int[] D= new int[]{getMin(x_axis), getMax(y_axis)};

        square[0][0] = A[0];
        square[0][1] = A[1];
        square[1][0] = B[0];
        square[1][1] = B[1];
        square[2][0] = C[0];
        square[2][1] = C[1];
        square[3][0] = D[0];
        square[3][1] = D[1];

        return square;
    }

    private static int[][] transformb(int[][] b){
        int[] x_axis=new int[4];
        int[] y_axis=new int[4];
        int[][] square = new int[4][2];

        for(int i=0;i<4;i++){
            x_axis[i]=b[i][0];
            y_axis[i]=b[i][1];
        }

        int[] A= new int[]{getMin(x_axis), (getMax(y_axis)-getMin(y_axis))/2+getMin(y_axis)};
        int[] B= new int[]{(getMax(x_axis)-getMin(x_axis))/2+getMin(x_axis), getMax(y_axis)};
        int[] C= new int[]{getMax(x_axis), (getMax(y_axis)-getMin(y_axis))/2+getMin(y_axis)};
        int[] D= new int[]{(getMax(x_axis)-getMin(x_axis))/2+getMin(x_axis), getMin(y_axis)};

        n[0] = (getMax(x_axis)-getMin(x_axis))/2+getMin(x_axis);
        n[1] = (getMax(y_axis)-getMin(y_axis))/2+getMin(y_axis);

        square[0][0] = A[0];
        square[0][1] = A[1];
        square[1][0] = B[0];
        square[1][1] = B[1];
        square[2][0] = C[0];
        square[2][1] = C[1];
        square[3][0] = D[0];
        square[3][1] = D[1];

        return square;
    }

    public static int getMax(int[] inputArray){
        int maxValue = inputArray[0];
        for(int i=1;i < inputArray.length;i++){
            if(inputArray[i] > maxValue){
                maxValue = inputArray[i];
            }
        }
        return maxValue;
    }

    public static int getMin(int[] inputArray){
        int minValue = inputArray[0];
        for(int i=1;i<inputArray.length;i++){
        if(inputArray[i] < minValue){
            minValue = inputArray[i];
            }
        }
        return minValue;
    }

    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);

        int[][] a = new int[4][2];
        int[][] b = new int[4][2];

        for(int i=0;i<4;i++){
            for(int j=0;j<2;j++){
                a[i][j]=scan.nextInt();
            }
        }
        for(int i=0;i<4;i++){
            for(int j=0;j<2;j++){
                b[i][j]=scan.nextInt();
            }
        }
        System.out.println(solve(transforma(a),transformb(b)));
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

	static boolean visited[] ;
	static boolean ends[] ;
	static long mod = 1000000007 ;
	static int lens[] ;
	static int seeds[] ;
	static int a[] ;
	static double total ;
	public static ArrayList adj[] ;
	public static long x,y ;
	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc =  new Scanner(System.in) ;

		int sq1[]= new int[8] ;
		int sq2[] = new int[8] ;

		for (int i = 0; i < sq2.length; i++)
		{
			sq1[i]=sc.nextInt() ;

		}
		for (int i = 0; i < sq2.length; i++)
		{
			sq2[i] = sc.nextInt() ;
		}

		int sq1x1 , sq1x2 ;
		int sq2x1 , sq2x2 ;
		int sq1y1 , sq1y2 ;
		int sq2y1 , sq2y2 ;
		int sq2x3 , sq2y3 ;

		sq1x1 = sq1[0] ;
		sq1x2 = sq1[4] ;
		sq1y1 = sq1[1] ;
		sq1y2 = sq1[5];

		sq2x1 = sq2[0] ;
		sq2x2 = sq2[2] ;
		sq2x3 = sq2[4] ;
		sq2y1 = sq2[1] ;
		sq2y2 = sq2[3];
		sq2y3 = sq2[7] ;

		int tmp = sq1x1 ;
		sq1x1 = Math.min(sq1x1, sq1x2);
		sq1x2 = Math.max(tmp, sq1x2);
		tmp = sq1y1 ;
		sq1y1 = Math.min(sq1y1, sq1y2);
		sq1y2 = Math.max(tmp, sq1y2);

		int y2=Math.max(sq2y1, Math.max(sq2y2,sq2y3)) ;
		int y1=Math.min(sq2y1, Math.min(sq2y2,sq2y3)) ;

		int x2=Math.max(sq2x1, Math.max(sq2x2, sq2x3)) ;
		int x1=Math.min(sq2x1, Math.min(sq2x2, sq2x3)) ;

		for (int i = 0; i < sq2.length-1; i+=2)
			for (int j = 0; j < sq2.length-1; j+=2)
				if(sq1[i]==sq2[j] && sq1[i+1]==sq2[j+1])
				{System.out.println("YES"); return;}

		if(x2 <= sq1x2 && x2>=sq1x1 && x1 <= sq1x2 && x1>=sq1x1 &&y2 <= sq1y2 && y2>=sq1y1 && y1 <= sq1y2 && y1>=sq1y1)
		{System.out.println("YES"); return ;}

		if(sq1x2 <= x2 && sq1x2>=x1 && sq1x1 <= x2 && sq1x1>=x1 &&sq1y2 <= y2 && sq1y2>=y1 && sq1y1 <=y2 && sq1y1>=y1)
		{System.out.println("YES"); return ;}

		if(sq1x2<x1 || x2<sq1x1 || sq1y2<y1 || sq1y1>y2)
		{System.out.println("NO"); return;}

		System.out.println("YES");

	}

	public static int neededFromLeft(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				c ++;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return c;
	}

	public static int neededFromRight(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;
		boolean f=true;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f=false;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return st.size();
	}

	public static boolean fromBoth(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		boolean f1=true ,f2=true ;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f1 =false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)f2 = false ;

		if(f1==false && f2==false)
			return true ;
		else
			return false;
	}

	public static boolean isRegular(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				return false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)return false ; else return true ;
	}

	public static int gcdExtended(int a, int b)
	{
		// Base Case
		if (a == 0)
		{
			x = 0;
			y = 1;
			return b;
		}

		//int x1=1, y1=1; // To store results of recursive call
		int gcd = gcdExtended(b%a, a);

		// Update x and y using results of recursive
		// call
		long x1 = y - (b/a) * x;
		long y1 = x;
		x = x1 ;
		y = y1 ;

		return gcd;
	}

	static int even(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2==0)
				return current ;
		}
		return -1;
	}
	static int odd(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2!=0)
				return current ;
		}
		return -1;
	}
	static long pow(long base, int exp) {
		long res = 1;
		while(exp > 0) {
			if(exp % 2 == 1) {
				res = (res * base) % mod;
			}

			base = (base * base) % mod;
			exp /= 2;
		}

		return res;
	}
	public static long solve(int k1, long k2)
	{
		long x   = 1l*k2*(pow(2, k1)-1) ;
		return x%(1000000007) ;
	}

	public static long getN(long x)
	{
		long n = (long) Math.sqrt(x*2) ;
		long y = n*(n+1)/2;
		if(y==x)
			return n ;
		else if(y>x)
			return n ;
		else
			for (long i = n; ; i++)
			{
				y = i*(i+1)/2 ;
				if(y>=x)
					return i ;

			}	}

	public static void dfss(int root , int len)
	{
		visited[root]=true ;
		if(ends[root] && root!=0) lens[root] = len ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c= (int) adj[root].get(i) ;
			if(visited[c]==false)
				dfss(c, len+1);
		}
	}

	public static void pr(int root ,  int seed){
		visited[root] = true ;
		int dv = adj[root].size()-1 ;
		if(root==0) dv++ ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c = (int)adj[root].get(i) ;
			seeds[c]=dv*seed ;
		}

		for (int i = 0; i < adj[root].size() ; i++)
		{
			int c = (int)adj[root].get(i) ;
			if(visited[c]==false)
				pr(c , seeds[c]);

		}

	}

	public static String concatinate(String s ,int n)
	{
		if(s.length()==n)
			return s ;
		else return concatinate("0"+s, n) ;
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

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

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

	public static long getGCD(long n1, long n2) {
		if (n2 == 0) {
			return n1;
		}
		return getGCD(n2, n1 % n2);
	}

	public static int cnt1(int mat[][])  //how many swaps to be a 1 matrix
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2==0 && mat[i][j]==0)
					c++;
				if(x%2!=0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}
	public static int cnt0(int mat[][])
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2!=0 && mat[i][j]==0)
					c++;
				if(x%2==0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}

	public static boolean canFit2(int x1, int y1 , int x2 , int y2 , int x3 , int y3){
		if(x1==x2)
			if(x1==x3)
				return true ;
			else
				return false ;
		else
			if(x1==x3)
				return false ;
			else
			{
				long a = 1l*(y2-y1)*(x3-x2) ;
				long b = 1l*(y3-y2)*(x2-x1) ;

				if(a==b)
					return true;
				else
					return false ;

			}

	}
	public static void shuffle(pair[] ss){
		if(ss.length==1)
			return ;
		for (int i = 0; i < ss.length; i++)
		{
			Random rand = new Random();

			int  n = rand.nextInt(ss.length-1) + 0;

			pair temp = ss[i] ;
			ss[i] = ss[n] ;
			ss[n] = temp ;
		}
	}
	public static int binary(ArrayList<pair> arr, int l, int r, long x)   /// begin by 0 and n-1
	{
		if (r>=l)
		{
			int mid = l + (r - l)/2;
			if (arr.get(mid).x== x)
				return mid;
			if (arr.get(mid).x> x)
				return binary(arr, l, mid-1, x);
			return binary(arr, mid+1, r, x);
		}
		return -1;
	}

	/// searching for the index of first elment greater than x
	public static int binary1(int[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid] <= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				low = mid + 1;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				high = mid;
			}
		}
		return low ; // return high ;
	}

	////// searching for last element less than X
	public static int binary2(pair[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid].x >= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				high=mid;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				low = mid+1 ;
			}
		}
		return low ; // return high ;
	}

	private static boolean triangle(int a, int b , int c){
		if(a+b>c && a+c>b && b+c>a)
			return true ;
		else
			return false ;
	}
	private static boolean segment(int a, int b , int c){
		if(a+b==c || a+c==b && b+c==a)
			return true ;
		else
			return false ;
	}
	private static int gcdThing(long a, long b) {
		BigInteger b1 = BigInteger.valueOf(a);
		BigInteger b2 = BigInteger.valueOf(b);
		BigInteger gcd = b1.gcd(b2);
		return gcd.intValue();
	}

	public static boolean is(int i){
		if(Math.log(i)/ Math.log(2) ==(int) (Math.log(i)/ Math.log(2)))
			return true ;
		if(Math.log(i)/ Math.log(3) ==(int) (Math.log(i)/ Math.log(3)) )
			return true ;
		if(Math.log(i)/ Math.log(6) ==(int) (Math.log(i)/ Math.log(6)) )
			return true ;

		return false;

	}
	public static boolean contains(int b[] , int x)
	{
		for (int i = 0; i < b.length; i++)
		{
			if(b[i]==x)
				return true ;
		}
		return false ;
	}
	public static int binary(long []arr , long target , int low , long shift) {
		int high = arr.length;
		while (low != high) {
			int mid = (low + high) / 2;
			if (arr[mid]-shift <= target) {
				low = mid + 1;
			}
			else {
				high = mid;
			}
		}
		return low ; // return high ;
	}
	public static boolean isLetter(char x){
		if(x+0 <=122 && x+0 >=97 )
			return true ;
		else if (x+0 <=90 && x+0 >=65 )
			return true ;
		else return false;
	}
	public static long getPrimes(long x ){
		if(x==2 || x==3 || x==1)
			return 2 ;
		if(isPrime(x))
			return 5 ;
		for (int i = 2; i*i<=x; i++)
		{
			if(x%i==0 && isPrime(i))
				return getPrimes(x/i) ;
		}
		return -1;
	}
	public static String solve11(String x){

		int n = x.length() ;
		String y = "" ;
		for (int i = 0; i < n-2; i+=2)
		{
			if(ifPalindrome(x.substring(i, i+2)))
				y+= x.substring(i, i+2) ;
			else
				break ;
		}
		return y+ solve11(x.substring(y.length(),x.length())) ;

	}
	public static String solve1(String x){
		String y = x.substring(0 , x.length()/2) ;
		return "" ;

	}
	public static String reverse(String x){
		String y ="" ;
		for (int i = 0; i < x.length(); i++)
		{
			y  = x.charAt(i) + y ;
		}
		return y ;
	}

	public static boolean ifPalindrome(String x){
		int numbers[] = new int[10] ;
		for (int i = 0; i < x.length(); i++)
		{
			int z = Integer.parseInt(x.charAt(i)+"") ;
			numbers[z] ++ ;
		}
		for (int i = 0; i < numbers.length; i++)
		{
			if(numbers[i]%2!=0)
				return false;
		}
		return true ;
	}

	public static int get(int n){
		return n*(n+1)/2 ;
	}
	//		public static long getSmallestDivisor( long y){
	//			if(isPrime(y))
	//				return -1;
	//
	//			for (long i = 2; i*i <= y; i++)
	//			{
	//				if(y%i ==0)
	//				{
	//					return i;
	//				}
	//			}
	//			return -1;
	//		}
	public static int lis( int[]a , int n){
		int lis[] = new int[n] ;
		Arrays.fill(lis,1) ;

		for(int i=1;i<n;i++)
			for(int j=0 ; j<i; j++)
				if (a[i]>a[j] &&  lis[i] < lis[j]+1)
					lis[i] = lis[j] + 1;

		int max = lis[0];

		for(int i=1; i<n ; i++)
			if (max < lis[i])
				max = lis[i] ;
		return (max);

		//			ArrayList<Integer> s = new ArrayList<Integer>() ;
		//			for (int i = n-1; i >=0; i--)
		//			{
		//				if(lis[i]==max)
		//				{
		//					s.add(a[i].z);
		//					max --;
		//				}
		//			}
		//
		//			for (int i = s.size()-1 ; i>=0 ;  i--)
		//			{
		//				System.out.print(s.get(i)+" ");
		//			}
		//
	}
	public static int calcDepth(Vertix node){
		if(node.depth>0) return node.depth;
		// meaning it has been updated before;
		if(node.parent != null)
			return 1+ calcDepth(node.parent);
		else
			return -1;
	}

	public static boolean isPrime (long num){
		if (num < 2) return false;
		if (num == 2) return true;
		if (num % 2 == 0) return false;
		for (int i = 3; i * i <= num; i += 2)
			if (num % i == 0) return false;
		return true;
	}

	public static ArrayList<Long> getDiv(Long n)
	{
		ArrayList<Long>  f = new ArrayList<Long>() ;

		while (n%2==0)
		{
			if(!f.contains(2))f.add((long) 2) ;
			n /= 2;
		}

		// n must be odd at this point.  So we can
		// skip one element (Note i = i +2)
		for (long i = 3; i <= Math.sqrt(n); i+= 2)
		{
			// While i divides n, print i and divide n
			while (n%i == 0)
			{
				if(!f.contains(i))f.add(i);
				n /= i;
			}
		}

		// This condition is to handle the case whien
		// n is a prime number greater than 2
		if (n > 2)
			if(!f.contains(n))f.add(n);

		return f ;

	}

	//		public static boolean dfs(Vertix v , int target){
	//			try{
	//				visited[v.i]= true ;
	//			} catch (NullPointerException e)
	//			{
	//				System.out.println(v.i);
	//			}
	//			if(v.i == target)
	//
	//				return true ;
	//			for (int i =0 ; i< v.neighbours.size() ; i++)
	//			{
	//
	//				Vertix child = v.neighbours.get(i) ;
	//				if(child.i == target){
	//					found = true  ;
	//				}
	//				if(visited[child.i]==false){
	//					found |= dfs(child, target) ;
	//				}
	//			}
	//			return found;
	//		}

	public static class Vertix{
		long i ;
		int depth ;
		ArrayList<Vertix> neighbours ;
		Vertix parent ;
		Vertix child ;

		public Vertix(long i){
			this.i = i ;
			this.neighbours = new ArrayList<Vertix> () ;
			this.parent = null ;
			depth =-1;
			this.child = null ;
		}
	}

	public static class pair implements Comparable<pair> {
		int x ;
		int y ;
		int i;

		public pair(int x, int y, int i ){

			this.x=x ;
			this.y =y ;
			this.i =i ;

		}

		@Override
		public int compareTo(pair p) {
			if(this.x > p.x)
				return 1 ;
			else if (this.x == p.x)
				return 0 ;
			else
				return -1 ;
		}

	}

	public static class pair2 implements Comparable<pair2>{
		int i ;
		int j ;
		int plus ;

		public pair2(int i , int j , int plus){
			this.i =i ;
			this.j = j ;
			this.plus = plus ;
		}

		@Override
		public int compareTo(pair2 p) {
			if(this.j > p.j)
				return 1 ;
			else if (this.j == p.j) return 0 ;
			else
				return -1 ;
		}

	}

}

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

public class Solution {
    public static void main(String[] args) throws IOException {
        Solution s = new Solution();
        s.solve();
    }

    public void solve() throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] line = br.readLine().split(" ");
        int[] nums = new int[line.length];
        for (int i = 0; i < nums.length; ++i) {
            nums[i] = Integer.parseInt(line[i]);
        }
        int[] a = {nums[0], nums[1]};
        int[] b = {nums[2], nums[3]};
        int[] c = {nums[4], nums[5]};
        int[] d = {nums[6], nums[7]};
        Square alignedSquare = new Square(a, b, c, d, true);
        line = br.readLine().split(" ");
        nums = new int[line.length];
        for (int i = 0; i < nums.length; ++i) {
            nums[i] = Integer.parseInt(line[i]);
        }
        a = new int[]{nums[0], nums[1]};
        b = new int[]{nums[2], nums[3]};
        c = new int[]{nums[4], nums[5]};
        d = new int[]{nums[6], nums[7]};
        Square slantedSquare = new Square(a, b, c, d, false);

        // iterate through y value of aligned square
        for (int row = alignedSquare.bl[1]; row <= alignedSquare.tl[1]; ++row) {
            int alignStart = alignedSquare.bl[0];
            int alignEnd = alignedSquare.br[0];

            if (row < slantedSquare.bot[1] && row > slantedSquare.top[1]) continue;

            int slantStart;
            int slantEnd;
            if (row <= slantedSquare.left[1]) {
                slantStart = slantedSquare.bot[0] + slantedSquare.bot[1] - row;
                slantEnd = slantedSquare.bot[0] + row - slantedSquare.bot[1];
            } else {
                slantStart = row + slantedSquare.left[0] - slantedSquare.left[1];
                slantEnd = slantedSquare.right[0] + slantedSquare.right[1] - row;
            }

            if ((alignStart <= slantEnd && alignEnd >= slantStart) || (slantStart <= alignEnd && slantEnd >= alignStart)) {
                System.out.println("YES");
                return;
            }
        }

        System.out.println("NO");

        br.close();
    }

    class Square {
        public int[] tl;
        public int[] tr;
        public int[] bl;
        public int[] br;
        public int[] top;
        public int[] left;
        public int[] right;
        public int[] bot;
        public Square(int[] a, int[] b, int[] c, int[] d, boolean aligned) {
            if (aligned) {
                int top = Math.max(Math.max(Math.max(a[1], b[1]), c[1]), d[1]);
                int bot = Math.min(Math.min(Math.min(a[1], b[1]), c[1]), d[1]);
                int lef = Math.min(Math.min(Math.min(a[0], b[0]), c[0]), d[0]);
                int rig = Math.max(Math.max(Math.max(a[0], b[0]), c[0]), d[0]);

                tl = new int[]{lef, top};
                tr = new int[]{rig, top};
                bl = new int[]{lef, bot};
                br = new int[]{rig, bot};
            } else {
                int rightMax = Math.max(Math.max(Math.max(a[0], b[0]), c[0]), d[0]);
                if (rightMax == a[0]) right = a;
                if (rightMax == b[0]) right = b;
                if (rightMax == c[0]) right = c;
                if (rightMax == d[0]) right = d;
                int leftMin = Math.min(Math.min(Math.min(a[0], b[0]), c[0]), d[0]);
                if (leftMin == a[0]) left = a;
                if (leftMin == b[0]) left = b;
                if (leftMin == c[0]) left = c;
                if (leftMin == d[0]) left = d;
                int topMax = Math.max(Math.max(Math.max(a[1], b[1]), c[1]), d[1]);
                if (topMax == a[1]) top = a;
                if (topMax == b[1]) top = b;
                if (topMax == c[1]) top = c;
                if (topMax == d[1]) top = d;
                int botMin = Math.min(Math.min(Math.min(a[1], b[1]), c[1]), d[1]);
                if (botMin == a[1]) bot = a;
                if (botMin == b[1]) bot = b;
                if (botMin == c[1]) bot = c;
                if (botMin == d[1]) bot = d;
            }
        }
    }
}

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

public class Main {

    void solve() {
        long x1[]=new long[4];
        long y1[]=new long[4];
        long x2[]=new long[4];
        long y2[]=new long[4];

        for(int i=0;i<4;i++){
            x1[i]=nl(); y1[i]=nl();
        }
        for(int i=0;i<4;i++){
            x2[i]=nl(); y2[i]=nl();
        }
        for(int i=0;i<4;i++){
            if(check(x1,y1,x2[i],y2[i])){
                pw.println("YES");
                return;
            }
        }
        long x0=0,y0=0;
        for(int i=0;i<4;i++){
            x2[i]-=x0; y2[i]-=y0;
            long xx=x2[i],yy=y2[i];
            x2[i]=(xx+yy);
            y2[i]=(-xx+yy);
        }

        for(int i=0;i<4;i++){
            x1[i]-=x0; y1[i]-=y0;
            long xx=x1[i],yy=y1[i];
            x1[i]=(xx+yy);
            y1[i]=(-xx+yy);
            if(check(x2,y2,x1[i],y1[i])){
                pw.println("YES");
                return;
            }
        }
        pw.println("NO");

    }
    boolean check(long x1[],long y1[],long x0,long y0){

        long mnx=Math.min(x1[0],Math.min(x1[1],x1[2])),mxx=Math.max(x1[0],Math.max(x1[1],x1[2]));
        long mny=Math.min(y1[0],Math.min(y1[1],y1[2])),mxy=Math.max(y1[0],Math.max(y1[1],y1[2]));

        return mnx<=x0 && x0<=mxx && mny<=y0 && y0<=mxy;

    }

    long M=(long)1e9+7;
    InputStream is;
    PrintWriter pw;
    String INPUT = "";
    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        pw = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        pw.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

    public static void main(String[] args) throws Exception { new Main().run(); }

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
}

/*
 *
 * @Author  Ajudiya_13(Bhargav Girdharbhai Ajudiya)
 * Dhirubhai Ambani Institute of Information And Communication Technology
 *
 */

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

public class Code3
{

	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int[] c1x = new int[5];
		int[] c1y = new int[5];
		int[] c2x = new int[5];
		int[] c2y = new int[5];
		c1x[1] = in.nextInt();
		c1y[1] = in.nextInt();
		c1x[2] = in.nextInt();
		c1y[2] = in.nextInt();
		c1x[3] = in.nextInt();
		c1y[3] = in.nextInt();
		c1x[4] = in.nextInt();
		c1y[4] = in.nextInt();

		c2x[1] = in.nextInt();
		c2y[1] = in.nextInt();
		c2x[2] = in.nextInt();
		c2y[2] = in.nextInt();
		c2x[3] = in.nextInt();
		c2y[3] = in.nextInt();
		c2x[4] = in.nextInt();
		c2y[4] = in.nextInt();

		boolean flag = false;
		for(int i=1;i<=4;i++)
		{
			if(check(c1x[1], c1y[1], c1x[2], c1y[2], c1x[3], c1y[3], c1x[4], c1y[4], c2x[i], c2y[i]))
			{
				flag = true;
				break;
			}

			if(check(c2x[1], c2y[1], c2x[2], c2y[2], c2x[3], c2y[3], c2x[4], c2y[4], c1x[i], c1y[i]))
			{
				flag = true;
				break;
			}
		}

		if(flag)
			pw.println("YES");
		else
			pw.println("NO");
		pw.flush();
		pw.close();
	}

	public static double area(int x1,int y1,int x2,int y2,int x3,int y3)
	{
		double ans = (double)(x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2));
		ans /= (double)2;
		ans = Math.abs(ans);
		return ans;
	}

	public static boolean check(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4,int x,int y)
	{
		double A = area(x1, y1, x2, y2, x3, y3)+
                area(x1, y1, x4, y4, x3, y3);

		double A1 = area(x, y, x1, y1, x2, y2);
		double A2 = area(x, y, x2, y2, x3, y3);
		double A3 = area(x, y, x3, y3, x4, y4);
		double A4 = area(x, y, x1, y1, x4, y4);

		return (A==A1+A2+A3+A4);
	}
	static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}

	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int n)
	{

	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (int i=5; i*i<=n; i=i+6)
	    {
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;
	    }

	    return true;
	}

	static class pair implements Comparable<pair>
	{
		Integer x, y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString()
		{
			return x+" "+y;
		}

		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return p.x == x && p.y == y ;
			}
			return false;
		}

		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}
}

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

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

	FastReader in = new FastReader();
	PrintWriter out = new PrintWriter(System.out);
	void run(){
		work();
		out.flush();
	}
	long mod=998244353;
	long gcd(long a,long b) {
		return b==0?a:gcd(b,a%b);
	}
	void work() {
		int[] A=new int[] {99999999,-1,99999999,-1};//x1,x2,y1,y2
		int[] B=new int[] {99999999,-1,-1,99999999};//l,u,r,d
		int[][] P1=new int[4][];
		int[][] P2=new int[4][];
		for(int i=0;i<4;i++) {
			int x=in.nextInt();
			int y=in.nextInt();
			P1[i]=new int[] {x,y};
			A[0]=Math.min(A[0], x);
			A[1]=Math.max(A[1], x);
			A[2]=Math.min(A[2], y);
			A[3]=Math.max(A[3], y);
		}
		for(int i=0;i<4;i++) {
			int x=in.nextInt();
			int y=in.nextInt();
			P2[i]=new int[] {x,y};
			B[0]=Math.min(B[0], x);
			B[1]=Math.max(B[1], y);
			B[2]=Math.max(B[2], x);
			B[3]=Math.min(B[3], y);
		}
		//不想交
		if(B[0]>A[1]||B[1]<A[2]||B[2]<A[0]||B[3]>A[3]) {
			out.println("NO");
			return;
		}
		//某点在正方形中
		if(check(A,P2[0])||check(A,P2[1])||check(A,P2[2])||check(A,P2[3])) {
			out.println("YES");
			return;
		}
		//某点在菱形中
		if(check3((A[0]+A[1])/2,(A[2]+A[3])/2,P2)) {
			out.println("YES");
			return;
		}
		//边相交
		if(check2(P1,P2[0],P2[1])||check2(P1,P2[0],P2[3])||check2(P1,P2[1],P2[2])||check2(P1,P2[2],P2[3])) {
			out.println("YES");
			return;
		}
		out.println("NO");
	}
	private boolean check3(int x,int y,int[][] A) {
		if(check4(x,y,A[0],A[1])!=check4(x,y,A[2],A[3])&&check4(x,y,A[0],A[3])!=check4(x,y,A[1],A[2])) {
			return true;
		}
		return false;
	}
	private boolean check4(int x, int y, int[] P1, int[] P2) {
		return P1[1]-(P1[0]-x)*(P1[1]-P2[1])/(P1[0]-P2[0])>y;
	}
	private boolean check2(int[][] P, int[] P1, int[] P2) {
		int[] count=new int[2];
		for(int i=0;i<4;i++) {
			int x=P[i][0];
			int y=P[i][1];
			int ny=P1[1]-(P1[0]-x)*(P1[1]-P2[1])/(P1[0]-P2[0]);
			if(ny==y)return true;
			if(ny>y)count[0]++;
			else {
				count[1]++;
			}
		}
		return count[0]>0&&count[1]>0;
	}
	private boolean check(int[] A, int[] P) {
		if(A[0]<=P[0]&&A[1]>=P[0]&&A[2]<=P[1]&&A[3]>=P[1]) {
			return true;
		}
		return false;
	}
}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

	public FastReader()
	{
		br=new BufferedReader(new InputStreamReader(System.in));
	}

	public String next()
	{
		if(st==null || !st.hasMoreElements())
		{
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	public int nextInt()
	{
		return Integer.parseInt(next());
	}

	public long nextLong()
	{
		return Long.parseLong(next());
	}
}

import java.util.Arrays;
import java.util.Scanner;

public class C {

	static class Point {
		int x;
		int y;

		public Point(int xx, int yy) {
			x = xx;
			y = yy;
		}
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Point[] a = new Point[4];
		for(int i = 0; i < 4; ++i) a[i] = new Point(in.nextInt(), in.nextInt());

		Point[] b = new Point[4];
		for(int i = 0; i < 4; ++i) b[i] = new Point(in.nextInt(), in.nextInt());
		in.close();

		if(check(a,b)) {
			System.out.println("YES");
		}
		else System.out.println("NO");

	}

	static boolean check(Point[] a, Point[] b) {

		for(int i = 0; i < 4; ++i) {
			for(int j = 0; j < 4; ++j) {
				if(intersect(a[i], a[(i+1)%4], b[j], b[(j+1)%4])) {
//					System.out.println("i = " + i + " j  = " + j);
//					System.out.println("From (" + a[i].x + ", " + a[i].y +") to (" + a[(i+1)%4].x + ", " + a[(i+1)%4].y +")");
//					System.out.println("From (" + b[j].x + ", " + b[j].y +") to (" + b[(j+1)%4].x + ", " + b[(j+1)%4].y +")");
					return true;
				}
			}
		}

		for(int i = 0; i < 4; ++i) {
			if(isInside(a, b[i])) return true;
		}

		for(int i = 0; i < 4; ++i) {
			if(isInside(b, a[i])) return true;
		}
		return false;
	}

	static boolean isInside(Point[] polygon, Point p)
	{
	    // There must be at least 3 vertices in polygon[]
	    if (polygon.length < 3)  return false;

	    // Create a point for line segment from p to infinite
	    Point extreme = new Point(10000, p.y);

	    // Count intersections of the above line with sides of polygon
	    int count = 0, i = 0;
	    do
	    {
	        int next = (i+1)%polygon.length;

	        // Check if the line segment from 'p' to 'extreme' intersects
	        // with the line segment from 'polygon[i]' to 'polygon[next]'
	        if (intersect(polygon[i], polygon[next], p, extreme))
	        {
	            // If the point 'p' is colinear with line segment 'i-next',
	            // then check if it lies on segment. If it lies, return true,
	            // otherwise false
	            if (direction(polygon[i], p, polygon[next]) == 0)
	               return onSegment(polygon[i], p, polygon[next]);

	            count++;
	        }
	        i = next;
	    } while (i != 0);

	    // Return true if count is odd, false otherwise
	    return (count%2 == 1);
	}

	public static boolean intersect(Point p1, Point p2, Point p3, Point p4) {
		int d1 = direction(p3, p4, p1); // p3p4, p3p1
		int d2 = direction(p3, p4, p2);
		int d3 = direction(p1, p2, p3);
		int d4 = direction(p1, p2, p4);
		if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0))) {
//			System.out.println("Here1");
			return true;
		}
		else if (d1 == 0 && onSegment(p3, p4, p1)) {
//			System.out.println("Here2");
			return true;
		}
		else if (d2 == 0 && onSegment(p3, p4, p2)) {
//			System.out.println("Here3");
			return true;
		}
		else if (d3 == 0 && onSegment(p1, p2, p3)) {
//			System.out.println("Here4");
			return true;
		}
		else if (d4 == 0 && onSegment(p1, p2, p4)) {
//			System.out.println("Here5");
			return true;
		}
		return false;
	}

	public static int direction(Point p1, Point p2, Point p3) {
		return (p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y);
	}

	public static boolean onSegment(Point p1, Point p2, Point p3) {
		return Math.min(p1.x, p2.x) <= p3.x && p3.x <= Math.max(p1.x, p2.x) && Math.min(p1.y, p2.y) <= p3.y
				&& p3.y <= Math.max(p1.y, p2.y);
	}

}

/**
 * Date: 16 Jun, 2018
 * Link:
 *
 * @author Prasad-Chaudhari
 * @email prasadc8897@gmail.com
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class newProgram5 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        Point a1 = new Point(in.ni(), in.ni());
        Point a2 = new Point(in.ni(), in.ni());
        Point a3 = new Point(in.ni(), in.ni());
        Point a4 = new Point(in.ni(), in.ni());
        Point b1 = new Point(in.ni(), in.ni());
        Point b2 = new Point(in.ni(), in.ni());
        Point b3 = new Point(in.ni(), in.ni());
        Point b4 = new Point(in.ni(), in.ni());

        if (getArea(a1, a2, b1) + getArea(a2, a3, b1) + getArea(a3, a4, b1) + getArea(a4, a1, b1) == 2 * getArea(a1, a2, a3)) {
            System.out.println("YES");
        } else if (getArea(a1, a2, b2) + getArea(a2, a3, b2) + getArea(a3, a4, b2) + getArea(a4, a1, b2) == 2 * getArea(a1, a2, a3)) {
            System.out.println("YES");
        } else if (getArea(a1, a2, b4) + getArea(a2, a3, b4) + getArea(a3, a4, b4) + getArea(a4, a1, b4) == 2 * getArea(a1, a2, a3)) {
            System.out.println("YES");
        } else if (getArea(a1, a2, b3) + getArea(a2, a3, b3) + getArea(a3, a4, b3) + getArea(a4, a1, b3) == 2 * getArea(a1, a2, a3)) {
            System.out.println("YES");
        } else if (getArea(b1, b2, a3) + getArea(b2, b3, a3) + getArea(b3, b4, a3) + getArea(b4, b1, a3) == 2 * getArea(b1, b2, b3)) {
            System.out.println("YES");
        } else if (getArea(b1, b2, a1) + getArea(b2, b3, a1) + getArea(b3, b4, a1) + getArea(b4, b1, a1) == 2 * getArea(b1, b2, b3)) {
            System.out.println("YES");
        } else if (getArea(b1, b2, a2) + getArea(b2, b3, a2) + getArea(b3, b4, a2) + getArea(b4, b1, a2) == 2 * getArea(b1, b2, b3)) {
            System.out.println("YES");
        } else if (getArea(b1, b2, a4) + getArea(b2, b3, a4) + getArea(b3, b4, a4) + getArea(b4, b1, a4) == 2 * getArea(b1, b2, b3)) {
            System.out.println("YES");
        } else {
            System.out.println("No");
        }
    }

    private static double getArea(Point a, Point b, Point c) {
        double ans = Math.abs(0.5 * (a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y)));
        return ans;
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

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

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

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

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
            bw.flush();
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
            bw.flush();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}

class Point {

    double x, y;

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

}

//package que_a;

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

public class utkarsh {

    InputStream is;
    PrintWriter out;

    long mod = (long) (1e9 + 7);
    boolean SHOW_TIME;

    class pair {
        long X, Y;
        pair (long x, long y) {
            X = x;  Y = y;
        }
    }

    long area(pair p, pair q, pair r) {
        return Math.abs(p.X * (q.Y - r.Y) + q.X * (r.Y - p.Y) + r.X * (p.Y - q.Y));
    }

    boolean play(pair[] a, pair p) {
        long A = area(a[0], a[1], a[2]) + area(a[0], a[3], a[2]);
        long B = area(a[0], a[1], p) + area(a[1], a[2], p) + area(a[2], a[3], p) + area(a[3], a[0], p);
        return A == B;
    }

    void solve() {
        //Enter code here utkarsh
        //SHOW_TIME = true;
        pair[] a = new pair[4];
        for(int i = 0; i < 4; i++) {
            a[i] = new pair(nl(), nl());
        }
        pair[] d = new pair[4];
        for(int i = 0; i < 4; i++) d[i] = new pair(nl(), nl());
        for(int i = 0; i < 4; i++) {
            if(play(a, d[i]) || play(d, a[i])) {
                out.println("YES"); return;
            }
        }
        out.println("NO");
    }

    //---------- I/O Template ----------

    public static void main(String[] args) { new utkarsh().run(); }
    void run() {
        is = System.in;
        out = new PrintWriter(System.out);
        long start = System.currentTimeMillis();
        solve();
        long end = System.currentTimeMillis();
        if(SHOW_TIME) out.println("\n" + (end - start) + " ms");
        out.flush();
    }

    byte input[] = new byte[1024];
    int len = 0, ptr = 0;

    int readByte() {
        if(ptr >= len) { ptr = 0;
            try { len = is.read(input); }
            catch(IOException e) { throw new InputMismatchException(); }
            if(len <= 0) { return -1; }
        } return input[ptr++];
    }
    boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); }
    int skip() {
        int b = readByte();
        while(b != -1 && isSpaceChar(b)) { b = readByte(); }
        return b;
    }

    char nc() { return (char)skip(); }
    String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    String nLine() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while( !(isSpaceChar(b) && b != ' ') ) { sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    int ni() {
        int n = 0, b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        if(b == -1) { return -1; }  //no input
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }
    long nl() {
        long n = 0L;    int b = readByte();
        boolean minus = false;
        while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }
        if(b == '-') { minus = true; b = readByte(); }
        while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }
        return minus ? -n : n;
    }

    double nd() { return Double.parseDouble(ns()); }
    float nf() { return Float.parseFloat(ns()); }
    int[] na(int n) {
        int a[] = new int[n];
        for(int i = 0; i < n; i++) { a[i] = ni(); }
        return a;
    }
    char[] ns(int n) {
        char c[] = new char[n];
        int i, b = skip();
        for(i = 0; i < n; i++) {
            if(isSpaceChar(b)) { break; }
            c[i] = (char)b; b = readByte();
        } return i == n ? c : Arrays.copyOf(c,i);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class C {
    static class Point {
        int x,y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Point point = (Point) o;
            return x == point.x &&
                    y == point.y;
        }

        @Override
        public int hashCode() {

            return Objects.hash(x, y);
        }

        @Override
        public String toString() {
            return x+","+y;
        }
    }
    static class Square {
        List<Point> points = new ArrayList<>();
    }

    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();

        Square A = readSquare(scanner);
        Square B = readSquare(scanner);

        int[][] regions=new int[200][200];

        draw(regions, B.points.get(0), B.points.get(1));
        draw(regions, B.points.get(1), B.points.get(2));
        draw(regions, B.points.get(2), B.points.get(3));
        draw(regions, B.points.get(3), B.points.get(0));

        int minx = A.points.stream().mapToInt(Point::getX).min().getAsInt();
        int maxx = A.points.stream().mapToInt(Point::getX).max().getAsInt();
        int miny = A.points.stream().mapToInt(Point::getY).min().getAsInt();
        int maxy = A.points.stream().mapToInt(Point::getY).max().getAsInt();

        for (int x=minx; x<=maxx; ++x) {
            for (int y=miny; y<=maxy;++y) {
                if (regions[x+100][y+100]==1) {
                    System.out.println("YES");
                    return;
                }
            }
        }

        System.out.println("NO");
    }

    static void draw(int[][] regions, Point a, Point b) {
        List<Integer> xs = new ArrayList<>();
        List<Integer> ys = new ArrayList<>();
        if (a.x<b.x) {
            for (int x = a.x; x <= b.x; ++x) {
                xs.add(x);
            }
        } else {
            for (int x = a.x; x >= b.x; --x) {
                xs.add(x);
            }
        }
        if (a.y<b.y) {
            for (int y=a.y;y<=b.y;++y) {
                ys.add(y);
            }
        } else {
            for (int y=a.y;y>=b.y;--y) {
                ys.add(y);
            }
        }

        for (int i=0; i<xs.size();++i) {
            regions[xs.get(i)+100][ys.get(i)+100]=1;
        }
        if (b.y<a.y && b.x<a.x) {
            regions[100+a.x][100+b.y]=1;
        }
    }

    private static Square readSquare(FastScanner scanner) {
        Square A = new Square();
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        return A;
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import javax.xml.crypto.dsig.keyinfo.KeyName;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;

public class Main {
    public static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    public static int[][] arr1;
    public static int[][] arr2;

    public static int read() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }

    public static void main(String[] args) throws IOException {
        arr1=new int[4][2];
        arr2=new int[4][2];
        int[][] map=new int[201][201];
        for (int i=0; i<8; i++) arr1[i/2][i%2]=read();
        for (int i=0; i<8; i++) arr2[i/2][i%2]=read();
        int x1,y1,x2,y2;
        x1=(arr1[0][0]+arr1[1][0]+arr1[2][0]+arr1[3][0])/4;
        y1=(arr1[0][1]+arr1[1][1]+arr1[2][1]+arr1[3][1])/4;
        x2=(arr2[0][0]+arr2[1][0]+arr2[2][0]+arr2[3][0])/4;
        y2=(arr2[0][1]+arr2[1][1]+arr2[2][1]+arr2[3][1])/4;
        int a1=Math.max(Math.abs(arr1[1][0]-arr1[0][0])/2,Math.abs(arr1[2][0]-arr1[0][0])/2);
        int a2=Math.abs(arr2[2][0]-arr2[0][0]+arr2[2][1]-arr2[0][1])/2;
        for (int i=-100; i<=100; i++){
            for (int j=-100; j<=100; j++){
                if (Math.abs(i-x1)<=a1 && Math.abs(j-y1)<=a1){
                    if (Math.abs(i-x2)+Math.abs(j-y2)<=a2){
                        System.out.println("Yes");
                        System.exit(0);
                    }
                }
            }
        }
        System.out.println("No");
    }
}

import java.util.*;
public class TwoSquares {
	static class Coord{
		int x, y;
		Coord(int a, int b){
			this.x = a;
			this.y = b;
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Coord[] s1 = new Coord[4];
		Coord[] s2 = new Coord[4];
		ArrayList<Integer> mx = new ArrayList<Integer>();
		ArrayList<Integer> my = new ArrayList<Integer>();
		for (int i=0; i<4; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			mx.add(x);
			my.add(y);
			s1[i] = new Coord(x, y);
		}
		for (int i=0; i<4; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			s2[i] = new Coord(x, y);
		}
		for (Coord c : s2) {
			if (c.x<=Collections.max(mx)&&c.x>=Collections.min(mx)&&c.y<=Collections.max(my)&&c.y>=Collections.min(my)) {
				System.out.println("YES");
				return;
			}
		}for (int i=0; i<4; i++) {
			s1[i] = new Coord(s1[i].x+s1[i].y, s1[i].x-s1[i].y);
		}for (int i=0; i<4; i++) {
			s2[i] = new Coord(s2[i].x+s2[i].y, s2[i].x-s2[i].y);
		}
		mx.clear();
		my.clear();
		for (int i=0; i<4; i++) {
			mx.add(s2[i].x);
			my.add(s2[i].y);
		}
		for (Coord c : s1) {
			if (c.x<=Collections.max(mx)&&c.x>=Collections.min(mx)&&c.y<=Collections.max(my)&&c.y>=Collections.min(my)) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");
	}

}

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

public class check {
    static boolean DEBUG_FLAG = false;
    int INF = (int)1e9;
    long MOD = 1000000007;

    static void debug(String s) {
        if(DEBUG_FLAG) {
            System.out.print(s);
        }
    }

    boolean go(int x1, int x2, int y1, int y2, int x, int y) {
        if(x1<=x && x<=x2) {
            if(y1<=y && y<=y2) {
                return true;
            }
        }
        return false;
    }

    boolean cross(int[][] a, int[][] b) {
        double x = 0;
        for(int i=0; i<4; i++) {
            for(int j=0; j<4; j++) {
                if(i!=j && a[i][0]==a[j][0]) {
                    x = Math.abs(a[i][1]-a[j][1]);
                }
            }
        }
        x *= x;
        x /= 2;
        for(int i=0; i<4; i++) {
            double y = ar(b[i][0], b[i][1], a[0][0], a[0][1], a[3][0], a[3][1]);
            y += ar(b[i][0], b[i][1], a[2][0], a[2][1], a[3][0], a[3][1]);
            y += ar(b[i][0], b[i][1], a[2][0], a[2][1], a[1][0], a[1][1]);
            y += ar(b[i][0], b[i][1], a[0][0], a[0][1], a[1][0], a[1][1]);
            double diff = Math.abs(y-x);
            if(diff<=1/1e6) return true;
        }
        return false;
    }

    double ar(int x1, int y1, int x2, int y2, int x3, int y3) {
        double a = x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2);
        if(a<0) a = -a;
        a/=2;
        return a;
    }

    void solve(InputReader in, PrintWriter out) throws IOException {
        int x1 = INF, x2 = -INF;
        int y1 = INF, y2 = -INF;
        int[][] b = new int[4][2];
        for(int i=0; i<4; i++) {
            int x = in.nextInt();
            int y = in.nextInt();
            x1 = Math.min(x, x1);
            x2 = Math.max(x, x2);
            y1 = Math.min(y, y1);
            y2 = Math.max(y, y2);
            b[i][0] = x;
            b[i][1] = y;
        }
        boolean f = false;
        int[][] a = new int[4][2];
        for(int i=0; i<4; i++) {
            a[i][0] = in.nextInt();
            a[i][1] = in.nextInt();
            f = f | go(x1, x2, y1, y2, a[i][0], a[i][1]);
        }
        f = f | cross(a, b);
        if(f) {
            out.println("YES");
        } else {
            out.println("NO");
        }
    }

    public static void main(String[] args) throws IOException {
        if(args.length>0 && args[0].equalsIgnoreCase("d")) {
            DEBUG_FLAG = true;
        }
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        long start = System.nanoTime();
        while(t-- >0) {
            new check().solve(in, out);
        }
        long end = System.nanoTime();
        debug("\nTime: " + (end-start)/1e6 + " \n\n");
        out.close();
    }

    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

import java.util.Scanner;

//http://codeforces.com/contest/994/problem/C
public class TwoSquares {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] sq1 = sc.nextLine().split(" ");
        String[] sq2 = sc.nextLine().split(" ");
        //find the bounding boxes
        int minXs1 = Integer.MAX_VALUE;
        int minXs2 = Integer.MAX_VALUE;
        int maxXs1 = Integer.MIN_VALUE;
        int maxXs2 = Integer.MIN_VALUE;
        int minYs1 = Integer.MAX_VALUE;
        int minYs2 = Integer.MAX_VALUE;
        int maxYs1 = Integer.MIN_VALUE;
        int maxYs2 = Integer.MIN_VALUE;

        //double input values because later I will divide by 2
        for (int i = 0; i < sq1.length; i++) {
            if (i % 2 == 0) {
                int x1 = Integer.parseInt(sq1[i]) * 2;
                int x2 = Integer.parseInt(sq2[i]) * 2;
                minXs1 = Math.min(minXs1, x1);
                minXs2 = Math.min(minXs2, x2);
                maxXs1 = Math.max(maxXs1, x1);
                maxXs2 = Math.max(maxXs2, x2);
            } else {
                int y1 = Integer.parseInt(sq1[i]) * 2;
                int y2 = Integer.parseInt(sq2[i]) * 2;
                minYs1 = Math.min(minYs1, y1);
                minYs2 = Math.min(minYs2, y2);
                maxYs1 = Math.max(maxYs1, y1);
                maxYs2 = Math.max(maxYs2, y2);
            }
        }

        //all those variables were useless, really we just need the centers and side lengths
        int centerXs1 = (minXs1 + maxXs1) / 2;
        int centerYs1 = (minYs1 + maxYs1) / 2;
        int centerXs2 = (minXs2 + maxXs2) / 2;
        int centerYs2 = (minYs2 + maxYs2) / 2;
        int s = (maxXs1 - minXs1) / 2;
        int d = (maxXs2 - minXs2) / 2;
        int centDist = Math.abs(centerXs1 - centerXs2) + Math.abs(centerYs1 - centerYs2);

        //solve with the maths
        if (centDist > 2 * s + 3 * d) {
            System.out.println("NO");
        } else {
            if (centerYs2 <= centerYs1 + s + d && centerYs1 >= centerYs1 - s - d &&
                    centerXs2 <= centerXs1 + s + d && centerXs1 >= centerXs1 - s - d) {
                    System.out.println("YES");

            } else {
                System.out.println("NO");
            }
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.PrintWriter;

public class Main {

    public static void main(String[]args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());
        P[] s1 = new P[4];
        LS[] l1 = new LS[4];
        build(st, s1, l1);
        st = new StringTokenizer(br.readLine());
        P[] s2 = new P[4];
        LS[] l2 = new LS[4];
        build(st, s2, l2);

        boolean inter = false;
        for (int i = 0; i < 4; i++) {
            if (inside(s1[i], s2)) {
                inter = true;
                //debug("in 1", s1[i]);
            }
        }
        for (int i = 0; i < 4; i++) {
            if (inside(s2[i], s1)) {
                inter = true;
                //("in 2", s2[i]);
            }
        }
        //debug(l1, l2);
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                if (crosses(l1[i], l2[j])) {
                    inter = true;
                    //debug("in 3", l1[i], l2[j], i, j);
                }
            }
        }
        if (inter) {
            pw.println("YES");
        }
        else {
            pw.println("NO");
        }
        pw.flush();
    }

    private static boolean crosses(LS l1, LS l2) {
        if (l1.xs == l1.xe) {
            double t = l2.getXT(l1.xs);
            if (t < 0 || t > 1) {
                return false;
            }
            double yt = l2.ys + t*l2.ye;
            return l1.containsY(yt);
        }
        else {
            double t = l2.getYT(l1.ys);
            if (t < 0 || t > 1) {
                return false;
            }
            double xt = l2.xs + t*l2.xe;
            return l1.containsX(xt);
        }
    }

    public static int sign(int s) {
        return (s < 0) ? -1 : (s > 0 ? 1 : 0);
    }

    public static int cross(P a, P b, P o) {
        return sign((a.x - o.x) * (b.y - o.y) - (b.x - o.x) * (a.y - o.y));
    }

    private static boolean inside(P p, P[] s2) {
        int ls = 0;
        for (int i = 0; i < s2.length; i++) {
            P o = s2[i];
            P b = (i == s2.length - 1) ? s2[0] : s2[i + 1];
            int sign = cross(p, b, o);
            if (i > 0) {
                if (ls != sign) return false;
            }
            ls = sign;
        }
        return true;
    }

    private static void build(StringTokenizer st, P[] s1, LS[] l1) {
        for (int i = 0; i < 4; i++) {
            int x = Integer.parseInt(st.nextToken());
            int y = Integer.parseInt(st.nextToken());
            s1[i] = new P(x, y);
        }
        for (int i = 0; i < 4; i++) {
            P p1 = s1[i];
            P p2 = s1[(i == 3) ? 0 : i + 1];
            l1[i] = new LS(p1.x, p1.y, p2.x, p2.y);
        }
    }

    private static class P {
        int x;
        int y;

        public P(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "P{" +
                    "x=" + x +
                    ", y=" + y +
                    '}';
        }
    }

    private static class LS {
        int xs;
        int ys;
        int xe;
        int ye;

        public LS(int xs, int ys, int xe, int ye) {
            this.xs = xs;
            this.ys = ys;
            this.xe = xe;
            this.ye = ye;
        }

        public double getXT(double ox) {
            double se = (xe - xs);
            return (ox - xs) / se;
        }
        public double getYT(double oy) {
            double se = (ye - ys);
            return (oy - ys) / se;
        }

        public boolean containsY(double yt) {
            double t = getYT(yt);
            return t >= 0 && t <= 1;
        }
        public boolean containsX(double xt) {
            double t = getXT(xt);
            return t >= 0 && t <= 1;
        }

        @Override
        public String toString() {
            return "LS{" +
                    "xs=" + xs +
                    ", ys=" + ys +
                    ", xe=" + xe +
                    ", ye=" + ye +
                    '}';
        }
    }

    public static void debug(Object...args) {
        System.out.println(Arrays.deepToString(args));
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeSet;

/*
....x.xxxxx.xxxxx.x...x.xxxxx.xxxxx.xxxxx.......xxxxx.xxxxx.xxxxx
....x.....x.....x.x...x.x.....x.........x...x...x...x.x...x.x...x
....x.....x.....x.x...x.x.....x.........x...x...x...x.x...x.x...x
....x.xxxxx.xxxxx.xxxxx.xxxxx.xxxxx.....x.xxxxx.xxxxx.xxxxx.x...x
....x.x.........x.....x.....x.x...x.....x...x...x...x.....x.x...x
....x.x.........x.....x.....x.x...x.....x...x...x...x.....x.x...x
....x.xxxxx.xxxxx.....x.xxxxx.xxxxx.....x.......xxxxx.xxxxx.xxxxx
 */
/**
 *
 * @author Andy Phan
 */
public class a {

    public static void main(String[] args) {
        FS in = new FS(System.in);
        PrintWriter out = new PrintWriter(System.out);

        VecL[] a = new VecL[4];
        for(int i = 0; i < 4; i++) a[i] = new VecL(in.nextInt(), in.nextInt());
        VecL[] b = new VecL[4];
        for(int i = 0; i < 4; i++) b[i] = new VecL(in.nextInt(), in.nextInt());

        for(int i = 0; i < 4; i++) {
            int[] num = new int[3];
            SegL t1 = new SegL(b[i], b[(i+1)%4]);
            for(int j = 0; j < 4; j++) {
                SegL t2 = new SegL(a[j], a[(j+1)%4]);
                if(t1.intersects(t2)) {
                    System.out.println("YES");
                    return;
                }
                num[(int)t2.side(b[i])+1]++;
            }
            if(Math.max(num[0], num[2]) == 4) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
        out.close();
    }

    static class VecL implements Comparable<VecL> {

        long x, y;

        public VecL(long x, long y) {
            this.x = x;
            this.y = y;
        }

        public VecL add(VecL o) {
            return new VecL(x + o.x, y + o.y);
        }

        public VecL sub(VecL o) {
            return new VecL(x - o.x, y - o.y);
        }

        public VecL scale(long s) {
            return new VecL(x * s, y * s);
        }

        public long dot(VecL o) {
            return x * o.x + y * o.y;
        }

        public long cross(VecL o) {
            return x * o.y - y * o.x;
        }

        public long mag2() {
            return dot(this);
        }

        public VecL rot90() {
            return new VecL(-y, x);
        }

        public VecL rot270() {
            return new VecL(y, -x);
        }

        public String toString() {
            return "(" + x + ", " + y + ")";
        }

        public int hashCode() {
            return Long.hashCode(x << 13 ^ (y * 57));
        }

        public boolean equals(Object oo) {
            VecL o = (VecL) oo;
            return x == o.x && y == o.y;
        }

        public int compareTo(VecL o) {
            if (x != o.x) {
                return Long.compare(x, o.x);
            }
            return Long.compare(y, o.y);
        }

        //origin->q1, axes-> quadrant in ccw direction
        public int quadrant() {
            if (x == 0 || y == 0) {
                if (y == 0) {
                    if (x >= 0) {
                        return 1;
                    } else {
                        return 3;
                    }
                } else if (y >= 0) {
                    return 2;
                } else {
                    return 4;
                }
            }
            if (x > 0) {
                if (y > 0) {
                    return 1;
                } else {
                    return 4;
                }
            } else if (y > 0) {
                return 2;
            } else {
                return 3;
            }
        }

        public int radialCompare(VecL o) {
            if (quadrant() == o.quadrant()) {
                return -Long.signum(cross(o));
            }
            return Integer.compare(quadrant(), o.quadrant());
        }
    }

    static class SegL {

        VecL from, to, dir;

        public SegL(VecL from, VecL to) {
            this.from = from;
            this.to = to;
            dir = to.sub(from);
        }

        //check if the segment contains the point
        public boolean contains(VecL p) {
            VecL d = p.sub(from);
            if (d.cross(dir) != 0) {
                return false;
            }
            long dot = d.dot(dir);
            return dot >= 0 && dot <= dir.mag2();
        }

        //(assuming I go left to right)
        //returns:
        //	1 if point is above me
        //	0 if point is on me
        //	-1 if point is below me
        public long side(VecL o) {
            long cross = dir.cross(o.sub(from));
            return cross == 0 ? 0 : cross / Math.abs(cross);
        }

        //returns true if this segl intersects the other, including at endpoints
        //note: returns false if the two segments lie on the same line
        public boolean intersects(SegL o) {
            return side(o.from) != side(o.to) && o.side(from) != o.side(to);
        }

        public String toString() {
            return from + " -> " + to;
        }

        //#
        static long gcd(long a, long b) {
            a = Math.abs(a);
            b = Math.abs(b);
            return b == 0 ? a : gcd(b, a % b);
        }
        //$

        //returns the lattice point of intersection or null if it is nonlattice or does not exist
        public VecL latticeIntersect(SegL o) {
            if (!intersects(o)) {
                return null;
            }
            long dirGCD = gcd(dir.x, dir.y), oDirGCD = gcd(o.dir.x, o.dir.y);
            VecL va=new   VecL(dir.x / dirGCD, dir.y / dirGCD), vb = new VecL(o.dir.x / oDirGCD, o.dir.y / oDirGCD);
            if (va.x < 0 && va.y < 0) {
                va.x *= -1;
                va.y *= -1;
            }
            if (vb.x < 0 && vb.y < 0) {
                vb.x *= -1;
                vb.y *= -1;
            }
            if (va.equals(vb)) {
                return null;
            }
            long bottomScalar = va.x / gcd(va.x, va.y);
            long topScalar = va.y / gcd(va.x, va.y);
            long t2Scalar = -bottomScalar * vb.y + topScalar * vb.x;
            long t2Ans = bottomScalar * (o.from.y - from.y) - topScalar * (o.from.x - from.x);
            if (t2Ans % t2Scalar != 0) {
                return null;
            }
            long t2 = t2Ans / t2Scalar;
            return new VecL(t2 * vb.x + o.from.x, t2 * vb.y + o.from.y);
        }
    }

    static class FS {

        BufferedReader in;
        StringTokenizer token;

        public FS(InputStream str) {
            in = new BufferedReader(new InputStreamReader(str));
        }

        public String next() {
            if (token == null || !token.hasMoreElements()) {
                try {
                    token = new StringTokenizer(in.readLine());
                } catch (IOException ex) {
                }
                return next();
            }
            return token.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

import java.util.*;
import java.awt.*;
import java.awt.geom.*;

public class Main {

    static final double eps = 1e-6;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while( sc.hasNext() ) {

                int x1[] = new int[4];
                int y1[] = new int[4];
                int x2[] = new int[4];
                int y2[] = new int[4];

                for( int i=0; i<4; i++ ) {
                        x2[i] = sc.nextInt();
                        y2[i] = sc.nextInt();
                }

                for( int i=0; i<4; i++ ) {
                        x1[i] = sc.nextInt();
                        y1[i] = sc.nextInt();
                }

                Polygon P = new Polygon( x1, y1, 4 );

                double x, y;
                double w, h;

                x = x2[0];
                y = y2[0];

                double xx = x2[0] - x2[1];

                double yy = y2[0] - y2[1];

                w = Math.sqrt( xx * xx + yy * yy );

                h = Math.sqrt( xx * xx + yy * yy );

                Polygon R = new Polygon( x2, y2, 4 );

                boolean fl = false;

                if( P.intersects( x, y, w, h ) ) {
                        fl = true;
                }

                Line2D a[] = new Line2D[4];
                Line2D b[] = new Line2D[4];

                for( int i=0; i<4; i++ ) {
                        a[i] = new Line2D.Double( x1[i], y1[i], x1[(i + 1 ) % 4], y1[(i + 1 ) % 4] );
                        b[i] = new Line2D.Double( x2[i], y2[i], x2[(i + 1 ) % 4], y2[(i + 1 ) % 4] );
                }

                for( int i=0; i<4; i++ ) {
                        for( int j=0; j<4; j++ ) {
                                if( a[i].intersectsLine( b[j] ) ) {
                                        fl = true;
                                }
                                if( b[j].intersectsLine( a[i] ) ) {
                                        fl = true;
                                }
                        }
                }

                for( int i=0; i<4; i++ ) {
                        if( R.contains( x1[i], y1[i] ) ) {
                                fl = true;
                        }
                }

                if( fl == true ) {
                        System.out.println( "YES" );
                }
                else {
                        System.out.println( "NO" );
                }

        }
    }
}

import java.io.*;
import java.util.Scanner;
public class Twosquares
{
    public static void main(String args[])throws IOException
    {
        Scanner sc=new Scanner(System.in);
        int x1=100;
        int x3=100;
        int y1=100;
        int y3=100;
        int x4=-100;
        int y2=-100;
        int y4=-100;
        int x2=-100;
        int a,b,i,j,c=0;
        for(i=0;i<4;i++)
        {
            a=sc.nextInt();
            b=sc.nextInt();
            x1=Math.min(x1,a);
            x2=Math.max(x2,b);
            y1=Math.min(y1,b);
            y2=Math.max(y2,b);
        }
        for(i=0;i<4;i++)
        {
            a=sc.nextInt();
            b=sc.nextInt();
            x3=Math.min(x3,a+b);
            x4=Math.max(x4,a+b);
            y3=Math.min(y3,a-b);
            y4=Math.max(y4,a-b);
        }
        for(i=x1;i<=x2;i++)
        {
            for(j=y1;j<=y2;j++)
            {
                if(i+j<=x4 && i+j>=x3 && i-j>=y3 && i-j<=y4)
                c=1;
            }
        }
        if(c==1)
            System.out.println("YES");
        else
        System.out.println("NO");
    }
}

/**
 * Date: 16 Jun, 2018
 * Link:
 *
 * @author Prasad-Chaudhari
 * @email prasadc8897@gmail.com
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class newProgram5 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        Point a1 = new Point(in.nd(), in.nd());
        Point a2 = new Point(in.nd(), in.nd());
        Point a3 = new Point(in.nd(), in.nd());
        Point a4 = new Point(in.nd(), in.nd());

        Point b1 = new Point(in.nd(), in.nd());
        Point b2 = new Point(in.nd(), in.nd());
        Point b3 = new Point(in.nd(), in.nd());
        Point b4 = new Point(in.nd(), in.nd());

        if (getArea(a1, a2, b1) + getArea(a2, a3, b1) + getArea(a3, a4, b1) + getArea(a4, a1, b1) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(a1, a2, b2) + getArea(a2, a3, b2) + getArea(a3, a4, b2) + getArea(a4, a1, b2) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
        }
        if (getArea(a1, a2, b4) + getArea(a2, a3, b4) + getArea(a3, a4, b4) + getArea(a4, a1, b4) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(a1, a2, b3) + getArea(a2, a3, b3) + getArea(a3, a4, b3) + getArea(a4, a1, b3) == 2 * getArea(a1, a2, a3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(b1, b2, a3) + getArea(b2, b3, a3) + getArea(b3, b4, a3) + getArea(b4, b1, a3) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(b1, b2, a1) + getArea(b2, b3, a1) + getArea(b3, b4, a1) + getArea(b4, b1, a1) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(b1, b2, a2) + getArea(b2, b3, a2) + getArea(b3, b4, a2) + getArea(b4, b1, a2) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
            return;
        }
        if (getArea(b1, b2, a4) + getArea(b2, b3, a4) + getArea(b3, b4, a4) + getArea(b4, b1, a4) == 2 * getArea(b1, b2, b3)) {
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }

    private static double getArea(Point a, Point b, Point c) {
        double ans = Math.abs(0.5 * (a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y)));
        return ans;
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

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

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

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

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
            bw.flush();
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
            bw.flush();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}

class Point {

    double x, y;

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div1_488A {

	static long[][] pt1;
	static long[][] pt2;

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

		StringTokenizer inputData = new StringTokenizer(reader.readLine());
		pt1 = new long[4][2];
		for (int i = 0; i < 4; i++) {
			pt1[i][0] = Integer.parseInt(inputData.nextToken());
			pt1[i][1] = Integer.parseInt(inputData.nextToken());
		}

		inputData = new StringTokenizer(reader.readLine());
		pt2 = new long[4][2];
		for (int i = 0; i < 4; i++) {
			pt2[i][0] = Integer.parseInt(inputData.nextToken());
			pt2[i][1] = Integer.parseInt(inputData.nextToken());
		}

		for (int i = 0; i < 4; i++) {
			if (inside(pt1[i], pt2)) {
				printer.println("YES");
				printer.close();
				return;
			}
			if (inside(pt2[i], pt1)) {
				printer.println("YES");
				printer.close();
				return;
			}
		}
		printer.println("NO");
		printer.close();
	}

	static boolean inside(long[] pt, long[][] pts) {
		long mag = -2;

		for (int i = 0; i < 4; i++) {
			long vX1 = pts[(i + 1) % 4][0] - pts[i][0];
			long vY1 = pts[(i + 1) % 4][1] - pts[i][1];
			long vX2 = pt[0] - pts[i][0];
			long vY2 = pt[1] - pts[i][1];
			long cCross = cross(vX1, vY1, vX2, vY2);
			if (cCross == 0) {
				continue;
			}
			if (mag == -2) {
				mag = Long.signum(cCross);
			} else {
				if (Long.signum(cCross) != mag) {
					return false;
				}
			}
		}
		return true;
	}

	static long cross(long a, long b, long c, long d) {
		return a * d - b * c;
	}
}

import javax.xml.crypto.dsig.keyinfo.KeyName;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;

public class Main {
    public static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    public static int[][] arr1;
    public static int[][] arr2;

    public static int read() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }

    public static void main(String[] args) throws IOException {
        arr1=new int[4][2];
        arr2=new int[4][2];
        for (int i=0; i<8; i++) arr1[i/2][i%2]=read();
        for (int i=0; i<8; i++) arr2[i/2][i%2]=read();
        int a=Math.abs(arr2[1][0]-arr2[0][0]);
        for (int i=-100; i<=100; i++){
            for (int j=-100; j<=100; j++){
                boolean b1=false;
                boolean b2=false;
                for (int i0=0; i0<4; i0++){
                    int x1=arr1[i0][0];
                    int y1=arr1[i0][1];
                    int x2=arr1[(i0+1)%4][0];
                    int y2=arr1[(i0+1)%4][1];
                    if (i==x1 && i==x2){
                        if ((i<=x1 && i>=x2) || (i>=x1 && i<=x2)) b1=true;
                    }
                    if (i==y1 && i==y2){
                        if ((i<=y1 && i>=y2) || (i>=y1 && i<=y2)) b1=true;
                    }
                }
                for (int i0=0; i0<4; i0++){
                    int x1=arr2[i0][0];
                    int y1=arr2[i0][1];
                    int x2=arr2[(i0+1)%4][0];
                    int y2=arr2[(i0+1)%4][1];
                    if (Math.abs(i-x1)==Math.abs(j-y1) && Math.abs(i-x1)<=a && Math.abs(i-x2)<=a) b2=true;
                }
                if (b1 && b2){
                    System.out.println("Yes");
                    System.exit(0);
                }
            }
        }
        int x1=Math.min(arr1[0][0], arr1[2][0]);
        int y1=Math.min(arr1[0][1], arr1[2][1]);
        int x2=Math.max(arr1[0][0], arr1[2][0]);
        int y2=Math.max(arr1[0][1], arr1[2][1]);
        if (arr2[0][0]>=x1 && arr2[0][0]<=x2 && arr2[0][1]>=y1 && arr2[0][1]<=y2) System.out.println("Yes"); else System.out.println("No");
    }
}

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

public class C994{

	private void solve() throws Exception {
		Square degrees_0 = new Square(nextLong(), nextLong(), nextLong(), nextLong(), nextLong(), nextLong(), nextLong(), nextLong());
		Square degrees_90 = new Square(nextLong(), nextLong(), nextLong(), nextLong(), nextLong(), nextLong(), nextLong(), nextLong());
		boolean intersection = false;
		for(int i = 0; i < 4; i++) {
			intersection = intersection || degrees_90.isInside(degrees_0.x[i], degrees_0.y[i]);
		}
		for(int i = 0; i < 4; i++) {
			intersection = intersection || degrees_0.isInside(degrees_90.x[i], degrees_90.y[i]);
		}
		if(intersection) out.println("YES");
		else out.println("NO");
	}

	class Square{
		long[] x;
		long[] y;

		long[] line01;
		long[] line32;

		long[] line12;
		long[] line30;

		public Square(long x0, long y0, long x1, long y1, long x2, long y2, long x3, long y3) {
			x = new long[] {x0,x1,x2,x3};
			y = new long[] {y0,y1,y2,y3};

			line01 = line(x[0], y[0], x[1], y[1]);
			line32 = line(x[3], y[3], x[2], y[2]);

			line12 = line(x[1], y[1], x[2], y[2]);
			line30 = line(x[0], y[0], x[3], y[3]);
		}

		boolean isInside(long x, long y) {
			return signedDistance(line01,x,y)*signedDistance(line32,x,y) <= 0 && signedDistance(line12,x,y)*signedDistance(line30,x,y) <= 0 ;
		}

		long signedDistance(long[] coef, long x, long y) {
			long A = coef[0];
			long B = coef[1];
			long C = coef[2];
			return A*x+B*y+C;
		}

		long[] line(long x1, long y1, long x2, long y2) {
			return new long[] {y1-y2, x2-x1, (x1-x2)*y1+x1*(y2-y1)};
		}
	}

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

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer tokenizer;

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			tokenizer = null;
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

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

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

	private float nextFloat() throws IOException {
		return Float.parseFloat(nextToken());
	}

	private String nextLine() throws IOException {
		return new String(in.readLine());
	}

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

}

import sun.rmi.transport.DGCImpl_Stub;

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

public class Main {
    public static void main(String[] args) throws FileNotFoundException {
        ConsoleIO io = new ConsoleIO(new InputStreamReader(System.in), new PrintWriter(System.out));

//        String fileName = "C-large";
//        ConsoleIO io = new ConsoleIO(new FileReader("D:\\Dropbox\\code\\practice\\jb\\src\\" + fileName + ".in"), new PrintWriter(new File("D:\\Dropbox\\code\\practice\\jb\\src\\" + fileName + ".out")));

        new Main(io).solve();
//        new Main(io).solveLocal();

        io.close();
    }

    ConsoleIO io;
    Main(ConsoleIO io) {
        this.io = io;
    }
    ConsoleIO opt;
    Main(ConsoleIO io, ConsoleIO opt) {
        this.io = io; this.opt = opt;
    }

    List<List<Integer>> gr = new ArrayList<>();
    long MOD = 1_000_000_007;

    public void solve() {
        int[] par = io.readIntArray();
        int[] ang = io.readIntArray();
        for(int i = 0;i<par.length;i++){
            par[i]+=100;
            ang[i]+=100;
        }
        int[][] map = new int[201][201];

        int cax = (ang[0]+ang[2]+ang[4]+ang[6])/4;
        int cay = (ang[1]+ang[3]+ang[5]+ang[7])/4;

        int lx = Math.min(Math.min(ang[0],ang[2]), Math.min(ang[4], ang[6]));
        int rx = Math.max(Math.max(ang[0],ang[2]), Math.max(ang[4], ang[6]));
        int ly = Math.min(Math.min(ang[1],ang[3]), Math.min(ang[5], ang[7]));
        int ry = Math.max(Math.max(ang[1],ang[3]), Math.max(ang[5], ang[7]));
        for(int i = lx; i<=rx;i++){
            for(int j = cay-(i-lx); j<= cay+(i-lx); j++){
                map[i][j] |= 1;
            }
        }

        lx = Math.min(Math.min(par[0],par[2]), Math.min(par[4], par[6]));
        rx = Math.max(Math.max(par[0],par[2]), Math.max(par[4], par[6]));
        ly = Math.min(Math.min(par[1],par[3]), Math.min(par[5], par[7]));
        ry = Math.max(Math.max(par[1],par[3]), Math.max(par[5], par[7]));
        for(int i = lx;i<=rx;i++)
            for(int j = ly;j<=ry;j++)
                if(map[i][j] != 0){
                    io.writeLine("YES");
                    return;
                }
        io.writeLine("NO");
    }
}

class ConsoleIO {

    BufferedReader br;
    PrintWriter out;
    public ConsoleIO(Reader reader, PrintWriter writer){br = new BufferedReader(reader);out = writer;}
    public void flush(){this.out.flush();}
    public void close(){this.out.close();}
    public void writeLine(String s) {this.out.println(s);}
    public void writeInt(int a) {this.out.print(a);this.out.print(' ');}
    public void writeWord(String s){
        this.out.print(s);
    }
    public void writeIntArray(int[] a, int k, String separator) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < k; i++) {
            if (i > 0) sb.append(separator);
            sb.append(a[i]);
        }
        this.writeLine(sb.toString());
    }
    public int read(char[] buf, int len){try {return br.read(buf,0,len);}catch (Exception ex){ return -1; }}
    public String readLine() {try {return br.readLine();}catch (Exception ex){ return "";}}
    public long[] readLongArray() {
        String[]n=this.readLine().trim().split("\\s+");long[]r=new long[n.length];
        for(int i=0;i<n.length;i++)r[i]=Long.parseLong(n[i]);
        return r;
    }
    public int[] readIntArray() {
        String[]n=this.readLine().trim().split("\\s+");int[]r=new int[n.length];
        for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);
        return r;
    }
    public int[] readIntArray(int n) {
        int[] res = new int[n];
        char[] all = this.readLine().toCharArray();
        int cur = 0;boolean have = false;
        int k = 0;
        boolean neg = false;
        for(int i = 0;i<all.length;i++){
            if(all[i]>='0' && all[i]<='9'){
                cur = cur*10+all[i]-'0';
                have = true;
            }else if(all[i]=='-') {
                neg = true;
            }
            else if(have){
                res[k++] = neg?-cur:cur;
                cur = 0;
                have = false;
                neg = false;
            }
        }
        if(have)res[k++] = neg?-cur:cur;
        return res;
    }
    public int ri() {
        try {
            int r = 0;
            boolean start = false;
            boolean neg = false;
            while (true) {
                int c = br.read();
                if (c >= '0' && c <= '9') {
                    r = r * 10 + c - '0';
                    start = true;
                } else if (!start && c == '-') {
                    start = true;
                    neg = true;
                } else if (start || c == -1) return neg ? -r : r;
            }
        } catch (Exception ex) {
            return -1;
        }
    }
    public long readLong() {
        try {
            long r = 0;
            boolean start = false;
            boolean neg = false;
            while (true) {
                int c = br.read();
                if (c >= '0' && c <= '9') {
                    r = r * 10 + c - '0';
                    start = true;
                } else if (!start && c == '-') {
                    start = true;
                    neg = true;
                } else if (start || c == -1) return neg ? -r : r;
            }
        } catch (Exception ex) {
            return -1;
        }
    }
    public String readWord() {
        try {
            boolean start = false;
            StringBuilder sb = new StringBuilder();
            while (true) {
                int c = br.read();
                if (c!= ' ' && c!= '\r' && c!='\n' && c!='\t') {
                    sb.append((char)c);
                    start = true;
                } else if (start || c == -1) return sb.toString();
            }
        } catch (Exception ex) {
            return "";
        }
    }
    public char readSymbol() {
        try {
            while (true) {
                int c = br.read();
                if (c != ' ' && c != '\r' && c != '\n' && c != '\t') {
                    return (char) c;
                }
            }
        } catch (Exception ex) {
            return 0;
        }
    }
//public char readChar(){try {return (char)br.read();}catch (Exception ex){ return 0; }}
}
class Pair {
    public Pair(int a, int b) {this.a = a;this.b = b;}
    public int a;
    public int b;
}
class PairLL {
    public PairLL(long a, long b) {this.a = a;this.b = b;}
    public long a;
    public long b;
}
class Triple {
    public Triple(int a, int b, int c) {this.a = a;this.b = b;this.c = c;}
    public int a;
    public int b;
    public int c;
}

// CodeForces Round #799 C Fountains training TODO

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class TwoSquares {

	class Point {
		int x,y;
	}

	Point []a;
	Point []b;
	boolean intersect;

	private void readData(BufferedReader bin) throws IOException {
		String s = bin.readLine();
		String []ss = s.split(" ");
		a = new Point[4];
		b = new Point[4];
		for (int i=0; i<4; i++) {
			a[i] = new Point();
			b[i] = new Point();
		}
		a[0].x = Integer.parseInt(ss[0]);
		a[0].y = Integer.parseInt(ss[1]);
		a[1].x = Integer.parseInt(ss[2]);
		a[1].y = Integer.parseInt(ss[3]);
		a[2].x = Integer.parseInt(ss[4]);
		a[2].y = Integer.parseInt(ss[5]);
		a[3].x = Integer.parseInt(ss[6]);
		a[3].y = Integer.parseInt(ss[7]);
		s = bin.readLine();
		ss = s.split(" ");
		b[0].x = Integer.parseInt(ss[0]);
		b[0].y = Integer.parseInt(ss[1]);
		b[1].x = Integer.parseInt(ss[2]);
		b[1].y = Integer.parseInt(ss[3]);
		b[2].x = Integer.parseInt(ss[4]);
		b[2].y = Integer.parseInt(ss[5]);
		b[3].x = Integer.parseInt(ss[6]);
		b[3].y = Integer.parseInt(ss[7]);
	}

	void printRes() {
		System.out.println(intersect ? "YES" : "NO");
	}

	Point []bb = new Point[4];
	int amnx=1000111,amny=1000111,amxx=-1000222,amxy=-1000222;
	int mnx=1000111,mny=1000111,mxx=-1000222,mxy=-1000222;
	void countAA() {
		for (int i=0; i<4; i++) {
			amnx = Math.min(amnx, a[i].y);
			amny = Math.min(amny, a[i].y);
			amxx = Math.max(amxx, a[i].x);
			amxy = Math.max(amxy, a[i].y);
		}
	}

	boolean insideA(int x, int y) {
		boolean insx = amnx <= x && x <= amxx;
		boolean insy = amny <= y && y <= amxy;
		return insx && insy;
	}
	void countBB() {
		for (int i=0; i<4; i++) {
			bb[i] = new Point();
			bb[i].x = b[i].x + b[i].y;
			bb[i].y = b[i].x - b[i].y;
			if (mnx > bb[i].x) {
				mnx = bb[i].x;
			}
			mny = Math.min(mny, bb[i].y);
			mxx = Math.max(mxx, bb[i].x);
			mxy = Math.max(mxy, bb[i].y);
		}
	}

	boolean insideB(int x, int y) {
		int cx = x+y;
		int cy = x-y;
		boolean insx = mnx <= cx && cx <= mxx;
		boolean insy = mny <= cy && cy <= mxy;
		return insx && insy;
	}

	private void calculate() {
		countAA();
		countBB();
		for (int i=0; i<4; i++) {
			if (insideB(a[i].x, a[i].y)) {
				intersect = true;
				return;
			}
		}
		for (int i=0; i<4; i++) {
			if (insideA(b[i].x, b[i].y)) {
				intersect = true;
				return;
			}
		}
		int bcx = (b[0].x + b[2].x)/2;
		int bcy = (b[0].y + b[2].y)/2;
		if (insideA(bcx, bcy)) {
			intersect = true;
			return;
		}
		intersect = false;
	}

	public static void main(String[] args) throws IOException {
		// BufferedReader bin = new BufferedReader(new FileReader("cactus.in"));
		BufferedReader bin = new BufferedReader(
				new InputStreamReader(System.in));
		TwoSquares l = new TwoSquares();
		l.readData(bin);
		l.calculate();
		l.printRes();
	}
}

import java.util.Scanner;

public class CF993A {

    public static void main(String[] args) {
        new CF993A();

        Scanner scanner = new Scanner(System.in);

        int[][] square0 = new int[4][2];
        for (int i = 0; i < 4; i++) {
            square0[i][0] = scanner.nextInt();
            square0[i][1] = scanner.nextInt();
        }
        scanner.nextLine();
        int[][] square45 = new int[4][2];
        for (int i = 0; i < 4; i++) {
            square45[i][0] = scanner.nextInt();
            square45[i][1] = scanner.nextInt();
        }

        String isIntersect = "NO";
        isIntersect = isDiamondNodeInSuare(square0, square45);
        if ("YES".equals(isIntersect)) {
            System.out.println("YES");
        } else {
            System.out.println(isSquareNodeInDiamond(square0, square45));
        }

    }

    private static String isSquareNodeInDiamond(int[][] square, int[][] diamond) {
        int topX = diamond[0][0], topY = diamond[0][1], bottomX = diamond[0][0], bottomY = diamond[0][1];
        for (int i = 1; i < 4; i++) {
            if (diamond[i][1] > topY) {
                topX = diamond[i][0];
                topY = diamond[i][1];
            } else if (diamond[i][1] < bottomY) {
                bottomX = diamond[i][0];
                bottomY = diamond[i][1];
            }
        }
        int topLeftC = topY - topX;
        int topRightC = topY + topX;
        int bottomRightC = bottomY - bottomX;
        int bottomLeftC = bottomY + bottomX;
        for (int i = 0; i < 4; i++) {
            if ((square[i][1] - square[i][0] <= topLeftC)
                    && (square[i][1] + square[i][0] <= topRightC)
                    && (square[i][1] - square[i][0] >= bottomRightC)
                    && (square[i][1] + square[i][0] >= bottomLeftC)) {
                return "YES";
            }
        }
        return "NO";
    }

    static String isDiamondNodeInSuare(int[][] square, int[][] diamond) {
        for (int i = 0; i < 4; i++) {
            if (diamond[i][0] >= Math.min(Math.min(square[0][0], square[1][0]), Math.min(square[2][0], square[3][0]))
                    && diamond[i][0] <= Math.max(Math.max(square[0][0], square[1][0]), Math.max(square[2][0], square[3][0]))
                    && diamond[i][1] >= Math.min(Math.min(square[0][1], square[1][1]), Math.min(square[2][1], square[3][1]))
                    && diamond[i][1] <= Math.max(Math.max(square[0][1], square[1][1]), Math.max(square[2][1], square[3][1]))) {
                return "YES";
            }
        }
        int diamondCenterX = (diamond[0][0] + diamond[3][0]) / 2;
        int diamontCenterY = (diamond[0][1] + diamond[3][0]) / 2;
        if (diamondCenterX >= Math.min(Math.min(square[0][0], square[1][0]), Math.min(square[2][0], square[3][0]))
                && diamondCenterX <= Math.max(Math.max(square[0][0], square[1][0]), Math.max(square[2][0], square[3][0]))
                && diamontCenterY >= Math.min(Math.min(square[0][1], square[1][1]), Math.min(square[2][1], square[3][1]))
                && diamontCenterY <= Math.max(Math.max(square[0][1], square[1][1]), Math.max(square[2][1], square[3][1]))) {
            return "YES";
        }
        return "NO";
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

	static boolean visited[] ;
	static boolean ends[] ;
	static long mod = 1000000007 ;
	static int lens[] ;
	static int seeds[] ;
	static int a[] ;
	static double total ;
	public static ArrayList adj[] ;
	public static long x,y ;
	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc =  new Scanner(System.in) ;

		int x1[]= new int[4] ;
		int y1[]= new int[4] ;
		int x2[] = new int[4] ;
		int y2[] = new int[4] ;

		for (int i = 0; i < 4; i++)
		{
			x1[i]=sc.nextInt() ;
			y1[i]=sc.nextInt() ;

		}
		for (int i = 0; i < 4 ;i++)
		{
			x2[i]=sc.nextInt() ;
			y2[i]=sc.nextInt() ;
		}

		Arrays.sort(x1);
		Arrays.sort(x2);
		Arrays.sort(y1);
		Arrays.sort(y2);

		int h=y2[3]-y2[0] ;
		h=h/2 ;
		int begin=y2[0]+h ;
		HashMap<point, Integer> map =  new HashMap<point,Integer>() ;

		for (int i = 0; i <=h; i++)
			for (int j = x2[0]+i; j <=x2[3]-i; j++)
			{
				map.put(new point(j,begin+i),0) ;
				map.put(new point(j,begin-i),0) ;
			}

		for (int i = x1[0]; i <= x1[3]; i++)
			for (int j =y1[0]; j <= y1[3]; j++)
			{
				point p = new point(i , j);
				if(map.containsKey(p))
				{System.out.println("YES"); return ;}
			}

		System.out.println("NO");

	}

	public static int neededFromLeft(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				c ++;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return c;
	}

	public static int neededFromRight(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;
		boolean f=true;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f=false;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return st.size();
	}

	public static boolean fromBoth(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		boolean f1=true ,f2=true ;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f1 =false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)f2 = false ;

		if(f1==false && f2==false)
			return true ;
		else
			return false;
	}

	public static boolean isRegular(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				return false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)return false ; else return true ;
	}

	public static int gcdExtended(int a, int b)
	{
		// Base Case
		if (a == 0)
		{
			x = 0;
			y = 1;
			return b;
		}

		//int x1=1, y1=1; // To store results of recursive call
		int gcd = gcdExtended(b%a, a);

		// Update x and y using results of recursive
		// call
		long x1 = y - (b/a) * x;
		long y1 = x;
		x = x1 ;
		y = y1 ;

		return gcd;
	}

	static int even(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2==0)
				return current ;
		}
		return -1;
	}
	static int odd(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2!=0)
				return current ;
		}
		return -1;
	}
	static long pow(long base, int exp) {
		long res = 1;
		while(exp > 0) {
			if(exp % 2 == 1) {
				res = (res * base) % mod;
			}

			base = (base * base) % mod;
			exp /= 2;
		}

		return res;
	}
	public static long solve(int k1, long k2)
	{
		long x   = 1l*k2*(pow(2, k1)-1) ;
		return x%(1000000007) ;
	}

	public static long getN(long x)
	{
		long n = (long) Math.sqrt(x*2) ;
		long y = n*(n+1)/2;
		if(y==x)
			return n ;
		else if(y>x)
			return n ;
		else
			for (long i = n; ; i++)
			{
				y = i*(i+1)/2 ;
				if(y>=x)
					return i ;

			}	}

	public static void dfss(int root , int len)
	{
		visited[root]=true ;
		if(ends[root] && root!=0) lens[root] = len ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c= (int) adj[root].get(i) ;
			if(visited[c]==false)
				dfss(c, len+1);
		}
	}

	public static void pr(int root ,  int seed){
		visited[root] = true ;
		int dv = adj[root].size()-1 ;
		if(root==0) dv++ ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c = (int)adj[root].get(i) ;
			seeds[c]=dv*seed ;
		}

		for (int i = 0; i < adj[root].size() ; i++)
		{
			int c = (int)adj[root].get(i) ;
			if(visited[c]==false)
				pr(c , seeds[c]);

		}

	}

	public static String concatinate(String s ,int n)
	{
		if(s.length()==n)
			return s ;
		else return concatinate("0"+s, n) ;
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

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

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

	public static long getGCD(long n1, long n2) {
		if (n2 == 0) {
			return n1;
		}
		return getGCD(n2, n1 % n2);
	}

	public static int cnt1(int mat[][])  //how many swaps to be a 1 matrix
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2==0 && mat[i][j]==0)
					c++;
				if(x%2!=0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}
	public static int cnt0(int mat[][])
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2!=0 && mat[i][j]==0)
					c++;
				if(x%2==0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}

	public static boolean canFit2(int x1, int y1 , int x2 , int y2 , int x3 , int y3){
		if(x1==x2)
			if(x1==x3)
				return true ;
			else
				return false ;
		else
			if(x1==x3)
				return false ;
			else
			{
				long a = 1l*(y2-y1)*(x3-x2) ;
				long b = 1l*(y3-y2)*(x2-x1) ;

				if(a==b)
					return true;
				else
					return false ;

			}

	}
	public static void shuffle(pair[] ss){
		if(ss.length==1)
			return ;
		for (int i = 0; i < ss.length; i++)
		{
			Random rand = new Random();

			int  n = rand.nextInt(ss.length-1) + 0;

			pair temp = ss[i] ;
			ss[i] = ss[n] ;
			ss[n] = temp ;
		}
	}
	public static int binary(ArrayList<pair> arr, int l, int r, long x)   /// begin by 0 and n-1
	{
		if (r>=l)
		{
			int mid = l + (r - l)/2;
			if (arr.get(mid).x== x)
				return mid;
			if (arr.get(mid).x> x)
				return binary(arr, l, mid-1, x);
			return binary(arr, mid+1, r, x);
		}
		return -1;
	}

	/// searching for the index of first elment greater than x
	public static int binary1(int[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid] <= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				low = mid + 1;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				high = mid;
			}
		}
		return low ; // return high ;
	}

	////// searching for last element less than X
	public static int binary2(pair[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid].x >= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				high=mid;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				low = mid+1 ;
			}
		}
		return low ; // return high ;
	}

	private static boolean triangle(int a, int b , int c){
		if(a+b>c && a+c>b && b+c>a)
			return true ;
		else
			return false ;
	}
	private static boolean segment(int a, int b , int c){
		if(a+b==c || a+c==b && b+c==a)
			return true ;
		else
			return false ;
	}
	private static int gcdThing(long a, long b) {
		BigInteger b1 = BigInteger.valueOf(a);
		BigInteger b2 = BigInteger.valueOf(b);
		BigInteger gcd = b1.gcd(b2);
		return gcd.intValue();
	}

	public static boolean is(int i){
		if(Math.log(i)/ Math.log(2) ==(int) (Math.log(i)/ Math.log(2)))
			return true ;
		if(Math.log(i)/ Math.log(3) ==(int) (Math.log(i)/ Math.log(3)) )
			return true ;
		if(Math.log(i)/ Math.log(6) ==(int) (Math.log(i)/ Math.log(6)) )
			return true ;

		return false;

	}
	public static boolean contains(int b[] , int x)
	{
		for (int i = 0; i < b.length; i++)
		{
			if(b[i]==x)
				return true ;
		}
		return false ;
	}
	public static int binary(long []arr , long target , int low , long shift) {
		int high = arr.length;
		while (low != high) {
			int mid = (low + high) / 2;
			if (arr[mid]-shift <= target) {
				low = mid + 1;
			}
			else {
				high = mid;
			}
		}
		return low ; // return high ;
	}
	public static boolean isLetter(char x){
		if(x+0 <=122 && x+0 >=97 )
			return true ;
		else if (x+0 <=90 && x+0 >=65 )
			return true ;
		else return false;
	}
	public static long getPrimes(long x ){
		if(x==2 || x==3 || x==1)
			return 2 ;
		if(isPrime(x))
			return 5 ;
		for (int i = 2; i*i<=x; i++)
		{
			if(x%i==0 && isPrime(i))
				return getPrimes(x/i) ;
		}
		return -1;
	}
	public static String solve11(String x){

		int n = x.length() ;
		String y = "" ;
		for (int i = 0; i < n-2; i+=2)
		{
			if(ifPalindrome(x.substring(i, i+2)))
				y+= x.substring(i, i+2) ;
			else
				break ;
		}
		return y+ solve11(x.substring(y.length(),x.length())) ;

	}
	public static String solve1(String x){
		String y = x.substring(0 , x.length()/2) ;
		return "" ;

	}
	public static String reverse(String x){
		String y ="" ;
		for (int i = 0; i < x.length(); i++)
		{
			y  = x.charAt(i) + y ;
		}
		return y ;
	}

	public static boolean ifPalindrome(String x){
		int numbers[] = new int[10] ;
		for (int i = 0; i < x.length(); i++)
		{
			int z = Integer.parseInt(x.charAt(i)+"") ;
			numbers[z] ++ ;
		}
		for (int i = 0; i < numbers.length; i++)
		{
			if(numbers[i]%2!=0)
				return false;
		}
		return true ;
	}

	public static int get(int n){
		return n*(n+1)/2 ;
	}
	//		public static long getSmallestDivisor( long y){
	//			if(isPrime(y))
	//				return -1;
	//
	//			for (long i = 2; i*i <= y; i++)
	//			{
	//				if(y%i ==0)
	//				{
	//					return i;
	//				}
	//			}
	//			return -1;
	//		}
	public static int lis( int[]a , int n){
		int lis[] = new int[n] ;
		Arrays.fill(lis,1) ;

		for(int i=1;i<n;i++)
			for(int j=0 ; j<i; j++)
				if (a[i]>a[j] &&  lis[i] < lis[j]+1)
					lis[i] = lis[j] + 1;

		int max = lis[0];

		for(int i=1; i<n ; i++)
			if (max < lis[i])
				max = lis[i] ;
		return (max);

		//			ArrayList<Integer> s = new ArrayList<Integer>() ;
		//			for (int i = n-1; i >=0; i--)
		//			{
		//				if(lis[i]==max)
		//				{
		//					s.add(a[i].z);
		//					max --;
		//				}
		//			}
		//
		//			for (int i = s.size()-1 ; i>=0 ;  i--)
		//			{
		//				System.out.print(s.get(i)+" ");
		//			}
		//
	}
	public static int calcDepth(Vertix node){
		if(node.depth>0) return node.depth;
		// meaning it has been updated before;
		if(node.parent != null)
			return 1+ calcDepth(node.parent);
		else
			return -1;
	}

	public static boolean isPrime (long num){
		if (num < 2) return false;
		if (num == 2) return true;
		if (num % 2 == 0) return false;
		for (int i = 3; i * i <= num; i += 2)
			if (num % i == 0) return false;
		return true;
	}

	public static ArrayList<Long> getDiv(Long n)
	{
		ArrayList<Long>  f = new ArrayList<Long>() ;

		while (n%2==0)
		{
			if(!f.contains(2))f.add((long) 2) ;
			n /= 2;
		}

		// n must be odd at this point.  So we can
		// skip one element (Note i = i +2)
		for (long i = 3; i <= Math.sqrt(n); i+= 2)
		{
			// While i divides n, print i and divide n
			while (n%i == 0)
			{
				if(!f.contains(i))f.add(i);
				n /= i;
			}
		}

		// This condition is to handle the case whien
		// n is a prime number greater than 2
		if (n > 2)
			if(!f.contains(n))f.add(n);

		return f ;

	}

	//		public static boolean dfs(Vertix v , int target){
	//			try{
	//				visited[v.i]= true ;
	//			} catch (NullPointerException e)
	//			{
	//				System.out.println(v.i);
	//			}
	//			if(v.i == target)
	//
	//				return true ;
	//			for (int i =0 ; i< v.neighbours.size() ; i++)
	//			{
	//
	//				Vertix child = v.neighbours.get(i) ;
	//				if(child.i == target){
	//					found = true  ;
	//				}
	//				if(visited[child.i]==false){
	//					found |= dfs(child, target) ;
	//				}
	//			}
	//			return found;
	//		}

	public static class Vertix{
		long i ;
		int depth ;
		ArrayList<Vertix> neighbours ;
		Vertix parent ;
		Vertix child ;

		public Vertix(long i){
			this.i = i ;
			this.neighbours = new ArrayList<Vertix> () ;
			this.parent = null ;
			depth =-1;
			this.child = null ;
		}
	}

	public static class pair implements Comparable<pair> {
		int x ;
		int y ;
		int i;

		public pair(int x, int y, int i ){

			this.x=x ;
			this.y =y ;
			this.i =i ;

		}

		@Override
		public int compareTo(pair p) {
			if(this.x > p.x)
				return 1 ;
			else if (this.x == p.x)
				return 0 ;
			else
				return -1 ;
		}

	}

	public static class pair2 implements Comparable<pair2>{
		int i ;
		int j ;
		int plus ;

		public pair2(int i , int j , int plus){
			this.i =i ;
			this.j = j ;
			this.plus = plus ;
		}

		@Override
		public int compareTo(pair2 p) {
			if(this.j > p.j)
				return 1 ;
			else if (this.j == p.j) return 0 ;
			else
				return -1 ;
		}

	}
	public static class point implements  Comparable<point>
	{
		int x, y ;
		public point(int x,int y){
			this.x=x ; this.y=y;
		}
		@Override
		public boolean equals(Object o) {

			// If the object is compared with itself then return true
			if (o == this) {
				return true;
			}

			/* Check if o is an instance of Complex or not
	          "null instanceof [type]" also returns false */
			if (!(o instanceof point)) {
				return false;
			}

			// typecast o to Complex so that we can compare data members
			point c = (point) o;

			// Compare the data members and return accordingly
			return Integer.compare(x, c.x) == 0
					&& Double.compare(y, c.y) == 0;
		}
		@Override
		public int compareTo(point p) {
			if(this.x == p.x && this.y ==p.y)
				return 0 ;
			else
				return -1 ;
		}

		@Override
		public int hashCode()
		{
			return x+y ;
		}

	}

}

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

// atharva washimkar
// Jun 16, 2018

public class CODEFORCES_994_C {

	// check if point m is inside rectangle (p1, p2, p3, p4)
	public static boolean inside (Point m, Point p1, Point p2, Point p3, Point p4) {
		Point p1p2 = new Point (p2.x - p1.x, p2.y - p1.y);
		Point p1m = new Point (m.x - p1.x, m.y - p1.y);

		Point p2p3 = new Point (p3.x - p2.x, p3.y - p2.y);
		Point p2m = new Point (m.x - p2.x, m.y - p2.y);

		int dotp1p2ANDp1m = dot (p1p2, p1m);
		int dotp1p2ANDp1p2 = dot (p1p2, p1p2);
		int dotp2p3ANDp2m = dot (p2p3, p2m);
		int dotp2p3ANDp2p3 = dot (p2p3, p2p3);

		return 0 <= dotp1p2ANDp1m && dotp1p2ANDp1m <= dotp1p2ANDp1p2
				       && 0 <= dotp2p3ANDp2m && dotp2p3ANDp2m <= dotp2p3ANDp2p3;
	}

	public static int dot (Point v1, Point v2) {
		return v1.x * v2.x + v1.y * v2.y;
	}

	public static void main (String[] t) throws IOException {
		INPUT in = new INPUT (System.in);
		PrintWriter out = new PrintWriter (System.out);

		Point[] s1 = new Point[4];

		for (int n = 0; n < 4; ++n)
			s1[n] = new Point (in.iscan (), in.iscan ());

		Point[] s2 = new Point[4];

		for (int n = 0; n < 4; ++n)
			s2[n] = new Point (in.iscan (), in.iscan ());

		boolean intersect = false;

		// check if points of s1 are in s2
		for (int n = 0; n < 4; ++n)
			intersect |= inside (s1[n], s2[0], s2[1], s2[2], s2[3]);

		// check if points of s2 are in s1
		for (int n = 0; n < 4; ++n)
			intersect |= inside (s2[n], s1[0], s1[1], s1[2], s1[3]);

		out.print (intersect ? "YES" : "NO");
		out.close ();
	}

	private static class Point {

		int x, y;

		public Point (int x, int y) {
			this.x = x;
			this.y = y;
		}
	}

	private static class INPUT {

		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar, numChars;

		public INPUT (InputStream stream) {
			this.stream = stream;
		}

		public INPUT (String file) throws IOException {
			this.stream = new FileInputStream (file);
		}

		public int cscan () throws IOException {
			if (curChar >= numChars) {
				curChar = 0;
				numChars = stream.read (buf);
			}

			if (numChars == -1)
				return numChars;

			return buf[curChar++];
		}

		public int iscan () throws IOException {
			int c = cscan (), sgn = 1;

			while (space (c))
				c = cscan ();

			if (c == '-') {
				sgn = -1;
				c = cscan ();
			}

			int res = 0;

			do {
				res = (res << 1) + (res << 3);
				res += c - '0';
				c = cscan ();
			}
			while (!space (c));

			return res * sgn;
		}

		public String sscan () throws IOException {
			int c = cscan ();

			while (space (c))
				c = cscan ();

			StringBuilder res = new StringBuilder ();

			do {
				res.appendCodePoint (c);
				c = cscan ();
			}
			while (!space (c));

			return res.toString ();
		}

		public double dscan () throws IOException {
			int c = cscan (), sgn = 1;

			while (space (c))
				c = cscan ();

			if (c == '-') {
				sgn = -1;
				c = cscan ();
			}

			double res = 0;

			while (!space (c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * UTILITIES.fast_pow (10, iscan ());

				res *= 10;
				res += c - '0';
				c = cscan ();
			}

			if (c == '.') {
				c = cscan ();
				double m = 1;

				while (!space (c)) {
					if (c == 'e' || c == 'E')
						return res * UTILITIES.fast_pow (10, iscan ());

					m /= 10;
					res += (c - '0') * m;
					c = cscan ();
				}
			}

			return res * sgn;
		}

		public long lscan () throws IOException {
			int c = cscan (), sgn = 1;

			while (space (c))
				c = cscan ();

			if (c == '-') {
				sgn = -1;
				c = cscan ();
			}

			long res = 0;

			do {
				res = (res << 1) + (res << 3);
				res += c - '0';
				c = cscan ();
			}
			while (!space (c));

			return res * sgn;
		}

		public boolean space (int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}

	public static class UTILITIES {

		static final double EPS = 10e-6;

		public static int lower_bound (int[] arr, int x) {
			int low = 0, high = arr.length, mid = -1;

			while (low < high) {
				mid = (low + high) / 2;

				if (arr[mid] >= x)
					high = mid;
				else
					low = mid + 1;
			}

			return low;
		}

		public static int upper_bound (int[] arr, int x) {
			int low = 0, high = arr.length, mid = -1;

			while (low < high) {
				mid = (low + high) / 2;

				if (arr[mid] > x)
					high = mid;
				else
					low = mid + 1;
			}

			return low;
		}

		public static int gcd (int a, int b) {
			return b == 0 ? a : gcd (b, a % b);
		}

		public static int lcm (int a, int b) {
			return a * b / gcd (a, b);
		}

		public static int fast_pow_mod (int b, int x, int mod) {
			if (x == 0) return 1;
			if (x == 1) return b;
			if (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;

			return b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;
		}

		public static int fast_pow (int b, int x) {
			if (x == 0) return 1;
			if (x == 1) return b;
			if (x % 2 == 0) return fast_pow (b * b, x / 2);

			return b * fast_pow (b * b, x / 2);
		}

		public static long choose (long n, long k) {
			k = Math.min (k, n - k);
			long val = 1;

			for (int i = 0; i < k; ++i)
				val = val * (n - i) / (i + 1);

			return val;
		}

		public static long permute (int n, int k) {
			if (n < k) return 0;
			long val = 1;

			for (int i = 0; i < k; ++i)
				val = (val * (n - i));

			return val;
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class C {
    static class Point {
        int x,y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Point point = (Point) o;
            return x == point.x &&
                    y == point.y;
        }

        @Override
        public int hashCode() {

            return Objects.hash(x, y);
        }

        @Override
        public String toString() {
            return x+","+y;
        }
    }
    static class Square {
        List<Point> points = new ArrayList<>();
    }

    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();

        Square A = readSquare(scanner);
        Square B = readSquare(scanner);

        Set<Point> regions = new HashSet<>();

        int minx = A.points.stream().mapToInt(Point::getX).min().getAsInt();
        int maxx = A.points.stream().mapToInt(Point::getX).max().getAsInt();
        int miny = A.points.stream().mapToInt(Point::getY).min().getAsInt();
        int maxy = A.points.stream().mapToInt(Point::getY).max().getAsInt();

        for (int x=minx; x < maxx; ++x) {
            for (int y=miny; y<maxy; ++y) {
                regions.add(new Point(x,y));
            }
        }

        minx = B.points.stream().mapToInt(Point::getX).min().getAsInt();
        maxx = B.points.stream().mapToInt(Point::getX).max().getAsInt();
        int midx=(minx+maxx)/2;
        miny = B.points.stream().mapToInt(Point::getY).min().getAsInt();
        maxy = B.points.stream().mapToInt(Point::getY).max().getAsInt();
        int midy=(miny+maxy)/2;

        int d=1;
        for (int y=miny; y<midy;++y, ++d) {
            for (int x=midx-d;x<midx+d;++x) {
                if (regions.contains(new Point(x,y))) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        for (int y=midy; y<maxy;++y,--d) {
            for (int x=midx-d;x<midx+d;++x) {
                if (regions.contains(new Point(x,y))) {
                    System.out.println("YES");
                    return;
                }
            }
        }

        for (Point p : A.points) {
            if (B.points.contains(p)) {
                System.out.println("YES");
                return;
            }
        }

        if (onside(A.points.get(0), A.points.get(1), B)||
                onside(A.points.get(1), A.points.get(2), B)||
                onside(A.points.get(2), A.points.get(3), B)||
                onside(A.points.get(3), A.points.get(0), B))  {
            System.out.println("YES");
            return;
        }

        System.out.println("NO");
    }

    private static boolean onside(Point a, Point b, Square H) {
        for (int x=Math.min(a.x, b.x); x<=Math.max(a.x,b.x);++x) {
            for (int y=Math.min(a.y, b.y); y <= Math.max(a.y, b.y); ++y) {
                if (H.points.contains(new Point(x,y))) {
                    return true;
                }
            }
        }
        return false;
    }

    private static Square readSquare(FastScanner scanner) {
        Square A = new Square();
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        return A;
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class C {
    static class Point {
        int x,y;

        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int getX() {
            return x;
        }

        public int getY() {
            return y;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Point point = (Point) o;
            return x == point.x &&
                    y == point.y;
        }

        @Override
        public int hashCode() {

            return Objects.hash(x, y);
        }

        @Override
        public String toString() {
            return x+","+y;
        }
    }
    static class Square {
        List<Point> points = new ArrayList<>();
    }

    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();

        Square A = readSquare(scanner);
        Square B = readSquare(scanner);

        Set<Point> regions = new HashSet<>();

        int minx = A.points.stream().mapToInt(Point::getX).min().getAsInt();
        int maxx = A.points.stream().mapToInt(Point::getX).max().getAsInt();
        int miny = A.points.stream().mapToInt(Point::getY).min().getAsInt();
        int maxy = A.points.stream().mapToInt(Point::getY).max().getAsInt();

        for (int x=minx; x < maxx; ++x) {
            for (int y=miny; y<maxy; ++y) {
                regions.add(new Point(x,y));
            }
        }

        minx = B.points.stream().mapToInt(Point::getX).min().getAsInt();
        maxx = B.points.stream().mapToInt(Point::getX).max().getAsInt();
        miny = B.points.stream().mapToInt(Point::getY).min().getAsInt();
        maxy = B.points.stream().mapToInt(Point::getY).max().getAsInt();

        for (int x=minx; x < maxx; ++x) {
            for (int y=miny; y<maxy; ++y) {
                if (regions.contains(new Point(x,y))) {
                    System.out.println("YES");
                    return;
                }
            }
        }

        for (Point p : A.points) {
            if (B.points.contains(p)) {
                System.out.println("YES");
                return;
            }
        }

        if (onside(A.points.get(0), A.points.get(1), B)||
                onside(A.points.get(1), A.points.get(2), B)||
                onside(A.points.get(2), A.points.get(3), B)||
                onside(A.points.get(3), A.points.get(0), B))  {
            System.out.println("YES");
            return;
        }

        System.out.println("NO");
    }

    private static boolean onside(Point a, Point b, Square H) {
        for (int x=Math.min(a.x, b.x); x<=Math.max(a.x,b.x);++x) {
            for (int y=Math.min(a.y, b.y); y <= Math.max(a.y, b.y); ++y) {
                if (H.points.contains(new Point(x,y))) {
                    return true;
                }
            }
        }
        return false;
    }

    private static Square readSquare(FastScanner scanner) {
        Square A = new Square();
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        A.points.add(new Point(scanner.nextInt(), scanner.nextInt()));
        return A;
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

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

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

	FastReader in = new FastReader();
	PrintWriter out = new PrintWriter(System.out);
	void run(){
		work();
		out.flush();
	}
	long mod=998244353;
	long gcd(long a,long b) {
		return b==0?a:gcd(b,a%b);
	}
	void work() {
		int[] A=new int[] {99999999,-1,99999999,-1};//x1,x2,y1,y2
		int[] B=new int[] {99999999,-1,-1,99999999};//l,u,r,d
		int[][] P1=new int[4][];
		int[][] P2=new int[4][];
		for(int i=0;i<4;i++) {
			int x=in.nextInt();
			int y=in.nextInt();
			P1[i]=new int[] {x,y};
			A[0]=Math.min(A[0], x);
			A[1]=Math.max(A[1], x);
			A[2]=Math.min(A[2], y);
			A[3]=Math.max(A[3], y);
		}
		for(int i=0;i<4;i++) {
			int x=in.nextInt();
			int y=in.nextInt();
			P2[i]=new int[] {x,y};
			B[0]=Math.min(B[0], x);
			B[1]=Math.max(B[1], y);
			B[2]=Math.max(B[2], x);
			B[3]=Math.min(B[3], y);
		}
		//不想交
		if(B[0]>A[1]||B[1]<A[2]||B[2]<A[0]||B[3]>A[3]) {
			out.println("NO");
			return;
		}
		//某点在正方形中
		if(check(A,P2[0])||check(A,P2[1])||check(A,P2[2])||check(A,P2[3])) {
			out.println("YES");
			return;
		}
		//某点在菱形中
		if(check3((A[0]+A[1])/2,(A[2]+A[3])/2,P2)) {
			out.println("YES");
			return;
		}
		//边相交
		if(check2(P1,P2[0],P2[1])||check2(P1,P2[0],P2[3])||check2(P1,P2[1],P2[2])||check2(P1,P2[2],P2[3])) {
			out.println("YES");
			return;
		}
		out.println("NO");
	}
	private boolean check3(int x,int y,int[][] A) {
		if(check4(x,y,A[0],A[1])!=check4(x,y,A[2],A[3])&&check4(x,y,A[0],A[3])!=check4(x,y,A[1],A[2])) {
			return true;
		}
		return false;
	}
	private boolean check4(int x, int y, int[] P1, int[] P2) {
		return P1[1]-(P1[0]-x)*(P1[1]-P2[1])/(P1[0]-P2[0])>y;
	}
	private boolean check2(int[][] P, int[] P1, int[] P2) {
		int[] count=new int[2];
		for(int i=0;i<4;i++) {
			int x=P[i][0];
			int y=P[i][1];
			int ny=P1[1]-(P1[0]-x)*(P1[1]-P2[1])/(P1[0]-P2[0]);
			if(ny==y)return true;
			if(ny>y)count[0]++;
			else {
				count[1]++;
			}
		}
		return count[0]>0&&count[1]>0;
	}
	private boolean check(int[] A, int[] P) {
		if(A[0]<=P[0]&&A[1]>=P[0]&&A[2]<=P[1]&&A[3]>=P[1]) {
			return true;
		}
		return false;
	}
}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

	public FastReader()
	{
		br=new BufferedReader(new InputStreamReader(System.in));
	}

	public String next()
	{
		if(st==null || !st.hasMoreElements())
		{
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	public int nextInt()
	{
		return Integer.parseInt(next());
	}

	public long nextLong()
	{
		return Long.parseLong(next());
	}
}

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;

public class C {

	static class Vector implements Comparable<Vector> {
	    public double x, y, z; //%
	    public double x0 = 0, y0 = 0, z0 = 0; //%
	    public static double epsilon = 1e-6; //%
	    public static Vector ORIGIN = new Vector(0, 0, 0); //%
	    public static int curId = 0; //%
	    public int id = Vector.curId++; //%

	    //#
	    // Constructor for normal vector
	    public Vector(double xx, double yy, double zz) {
	        x = xx;
	        y = yy;
	        z = zz;
	    }

	    // Constructor for 2d normal vector
	    public Vector(double xx, double yy) {
	        x = xx;
	        y = yy;
	        z = 0.0;
	    }

	    // Constructor for ray/line vector
	    public Vector(Vector a, Vector b) {
	        x = b.x - (x0 = a.x);
	        y = b.y - (y0 = a.y);
	        z = b.z - (z0 = a.z);
	    }

	    //$

	    //#
	    public static boolean equals(double a, double b) {
	        return Math.abs(a - b) < epsilon;
	    }

	    public Vector add(Vector v) {
	        return new Vector(x + v.x, y + v.y, z + v.z);
	    }

	    public Vector sub(Vector v) {
	        return new Vector(x - v.x, y - v.y, z - v.z);
	    }

	    public Vector scale(double s) {
	        return new Vector(new Vector(x0, y0, z0), new Vector((x * s) + x0, (y * s) + y0, (z * s) + z0));
	    }

	    public double mag() {
	        return Math.sqrt((x*x) + (y*y) + (z*z));
	    }

	    public double mag2() {
	        return dot(this);
	    }

	    public double dot(Vector v) {
	        return (x * v.x) + (y * v.y) + (z * v.z);
	    }

	    public Vector cross(Vector v) { return new Vector(y*v.z - z*v.y, z*v.x - x*v.z, x*v.y - y*v.x); }

	    public Vector normalize() {
	        double mag = mag();
	        return new Vector(new Vector(x0, y0, z0), new Vector((x / mag) + x0, (y / mag) + y0, (z / mag) + z0));
	    }
	    //$

	    // Returns this vector rotated 90 degrees clockwise //%
	    public Vector orthoCW() { return new Vector(y, -x, z); }

	    // Returns this vector rotated 90 degrees counter-clockwise //%
	    public Vector orthoCCW() { return new Vector(-y, x, z); }

	    //#
	    // Returns a rotated vector rotated on the XY plane around (c.x, c.y) (***Z value will NOT change***) //%
	    public Vector rotate(Vector c, double a) { return new Vector(new Vector(c.x, c.y, z0), this).rotate(a); }
	    //$

	    // Returns a rotated vector rotated on the XY plane around (x0, y0, z0) (***Z value will NOT change***) //%
	    public Vector rotate(double a) {
	        return new Vector(new Vector(x0, y0, z0), new Vector((x*Math.cos(a)) - (y*Math.sin(a)) + x0, (x*Math.sin(a)) + (y*Math.cos(a)) + y0, z + z0));
	    }

	    //#
	    public boolean pointOnLine(Vector p) {
	        if(equals(x, 0.0)) return equals(p.x, x0);
	        return equals(p.y - y0, (y/x) * (p.x - x0));
	    }

	    boolean intersects(Vector v) { return intersect(v) != null; }
	    //$

	    //#
	    // Returns a 2d vector of the intersection //%
	    // returns null if the lines don't intersect or are on top of each other //%
	    public Vector intersect(Vector v) {
	        Vector a = new Vector(x0, y0);
	        Vector c = new Vector(v.x0, v.y0);
	        return intersect(a, add(a), c, v.add(c));
	    }
	    //$

	    // Returns a 2d vector of the intersection of a -> b and c -> d //%
	    // Returns null if the lines are parallel //%
	    public static Vector intersect(Vector a, Vector b, Vector c, Vector d) {
	        double a1 = b.y - a.y, b1 = a.x - b.x, c1 = a1 * a.x + b1 * a.y;
	        double a2 = d.y - c.y, b2 = c.x - d.x, c2 = a2 * c.x + b2 * c.y;
	        double det = a1 * b2 - a2 * b1;
	        if (equals(det, 0)) return null;
	        return new Vector((b2 * c1 - b1 * c2) / det, (a1 * c2 - a2 * c1) / det);
	    }

	    //#
	    // Returns the point of intersection between this line and the line/vector v. //%
	    // Returns null if the lines are parallel or skew //%
	    public Vector intersect3D(Vector v) {
	        if(equals(cross(v).mag(), 0.0)) return null; //The lines are parallel
	        double s, t;
	        if(!equals(x, 0.0)) {
	            if(!equals(v.y, v.x * y / x)) {
	                s = y0 - v.y0 + (y * (v.x0 - x0) / x);
	                s /= v.y - (v.x * y / x);
	            } else if(!equals(v.z, v.x * z / x)) {
	                s = z0 - v.z0 + (z * (v.x0 - x0) / x);
	                s /= v.z - (v.x * z / x);
	            } else return null;
	            t = (v.x0 + (s * v.x) - x0) / x;
	        } else if(!equals(y, 0.0)) {
	            if(!equals(v.x, v.y * x / y)) {
	                s = x0 - v.x0 + (x * (v.y0 - y0) / y);
	                s /= v.x - (v.y * x / y);
	            } else if(!equals(v.z, v.y * z / y)) {
	                s = z0 - v.z0 + (z * (v.y0 - y0) / y);
	                s /= v.z - (v.y * z / y);
	            } else return null;
	            t = (v.y0 + (s * v.y) - y0) / y;
	        } else if(!equals(z, 0.0)) {
	            if(!equals(v.y, v.z * y / z)) {
	                s = y0 - v.y0 + (y * (v.z0 - z0) / z);
	                s /= v.y - (v.z * y / z);
	            } else if(!equals(v.x, v.z * x / z)) {
	                s = x0 - v.x0 + (x * (v.z0 - z0) / z);
	                s /= v.x - (v.z * x / z);
	            } else return null;
	            t = (v.z0 + (s * v.z) - z0) / z;
	        } else return null;
	        double newX = x0 + (t * x);
	        double newX2 = v.x0 + (s * v.x);

	        double newY = y0 + (t * y);
	        double newY2 = v.y0 + (s * v.y);

	        double newZ = z0 + (t * z);
	        double newZ2 = v.z0 + (s * v.z);

	        if(!equals(newX, newX2) || !equals(newY, newY2) || !equals(newZ, newZ2)) return null; //The lines are skew
	        return new Vector(newX, newY, newZ);
	    }
	    //$

	    // Gets angle between this vector and vector v (range: [0, pi] )
	    double angleBetween(Vector v) {
	        return Math.acos( Math.max(-1, Math.min(1, dot(v) / (mag() * v.mag()))) );
	    }

	    // Gets angle between this vector and vector v (range (-pi, pi] )
	    double angleTo(Vector v) {
	        // Can be changed to " > 0.0" to return -1 if the vectors are parallel //%
	        // (useful for checking if a point is to left/right OR on the line //%
	        if(this.cross(v).z >= 0.0)
	            return Math.acos( Math.max(-1.0, Math.min(1.0, this.dot(v) / (this.mag() * v.mag()))) );
	        return - Math.acos( Math.max(-1.0, Math.min(1.0, this.dot(v) / (this.mag() * v.mag()))) );
	    }

	    //#
	    // Returns only the sign of the angle between this vector and the vector v on the XY plane.
	    // +1 for to the left, -1 for to the left, and 0 for straight
	    int angleToSignum(Vector v) { return (int) Math.signum(cross(v).z); }
	    //$

	    //#
	    // Gets the value of sin(theta) and cos(theta) needed to rotate this vector to the vector v
	    // Only works on the XY plane currently
	    double[] getSinCosTo(Vector v) {
	        double mags = mag() * v.mag();
	        return new double[]{cross(v).z / mags, dot(v) / mags};
	    }
	    //$

	    //#
	    // Returns [0.0, 4.0] which allows these vectors to be sorted by angle
	    // 0.0 is a vector that is directly to the right
	    double getSortableAngleTo(Vector v) {
	        Vector r = v.sub(this);
	        double dot = r.dot(new Vector(1.0, 0.0)) / r.mag();
	        dot = 1.0 - dot;
	        if(r.y < 0.0)
	            dot = 4.0 - dot;
	        return dot;
	    }
	    //$

	    //#
	    // Checks if two vectors are orthogonal to each other
	    boolean isOrthogonal(Vector v) { return equals(this.dot(v), 0.0); }
	    //$

	    //#
	    // Checks if two vectors are in parallel
	    boolean isParallel(Vector v) { return equals(this.cross(v).mag(), 0.0); }
	    //$

	    /* Static functions using vectors */ //%

	    //#
	    // Returns the area of a triangle defined by three vertices
	    static double triangleArea(Vector p1, Vector p2, Vector p3) {
	        return p2.sub(p1).cross(p3.sub(p1)).mag() / 2.0;
	    }
	    //$

	    //#
	    // Returns only the sign of the angle between (p0, p1) and (p0, p2)
	    // +1 for to the left, -1 for to the right, and 0 for straight
	    static int angleToSignum(Vector p0, Vector p1, Vector p2) {
	        return new Vector(p0, p1).angleToSignum(new Vector(p0, p2));
	    }
	    //$

	    //#
	    // Check if a point is INSIDE a triangle defined by three points
	    static boolean pointInTriangle(Vector a, Vector b, Vector c, Vector p) {
	        int pab = (int) Math.signum(p.sub(a).cross(b.sub(a)).z);
	        int pbc = (int) Math.signum(p.sub(b).cross(c.sub(b)).z);
	        if (pab != pbc) return false;
	        int pca = (int) Math.signum(p.sub(c).cross(a.sub(c)).z);
	        return pab == pca;
	    }

	    // Checks if the edges of abc and def share ANY common points
	    // Does not check if one is contained in another
	    static boolean triTriIntersects(Vector a, Vector b, Vector c,
	            Vector d, Vector e, Vector f) {
	        if (segSegIntersects(a, b, d, e)) return true;
	        if (segSegIntersects(a, b, e, f)) return true;
	        if (segSegIntersects(a, b, f, d)) return true;

	        if (segSegIntersects(b, c, d, e)) return true;
	        if (segSegIntersects(b, c, e, f)) return true;
	        if (segSegIntersects(b, c, f, d)) return true;

	        if (segSegIntersects(a, c, d, e)) return true;
	        if (segSegIntersects(a, c, e, f)) return true;
	        if (segSegIntersects(a, c, f, d)) return true;

	        return false;
	    }
	    //$

	    //#
	    // Returns the distance from a point to a line defined by two points //%
	    static double pointLineDist(Vector l1, Vector l2, Vector p) {
	        Vector line = l2.sub(l1);  double l = line.dot(line);
	        double t = p.sub(l1).dot(line) / l;  return line.scale(t).add(l1).sub(p).mag();
	    }
	    //$

	    // Returns the distance from a point to a line segment defined by two points //%
	    static double pointLineSegDist(Vector l1, Vector l2, Vector p) {
	        Vector line = l2.sub(l1); double l = line.dot(line);
	        double t = p.sub(l1).dot(line) / l;
	        if (t < 0) return l1.sub(p).mag(); // Remove this line
	        else if(t > 1) return l2.sub(p).mag(); // & this for pointLineDist
	        return line.scale(t).add(l1).sub(p).mag();
	    }

	    // Returns the minimum distance between two line segments
	    static double lineLineDist(Vector p0, Vector p1, Vector p2, Vector p3) {
	        Vector u = p1.sub(p0), v = p3.sub(p2), w = p0.sub(p2);
	        double a = u.dot(u),  b = u.dot(v), c = v.dot(v),  d = u.dot(w);
	        double e = v.dot(w),  det = a * c - b * b;
	        if (det == 0) return pointLineDist(p0, p1, p2);
	        double s = (b * e - c * d) / det, t = (a * e - b * d) / det;
	        if (s >= 0 && s <= 1 && t >= 0 && t <= 1)
	            return w.add(u.scale(s).sub(v.scale(t))).mag();
	        double min = Math.min(pointLineDist(p0, p1, p2),
	                pointLineDist(p0, p1, p3));
	        return Math.min(Math.min(min, pointLineDist(p2, p3, p0)),
	                pointLineDist(p2, p3, p1));
	    }

	    // Returns true if the line segments a-b and c-d share any common points
	    // Add an epsilon if using doubles
	    static boolean segSegIntersects(Vector a, Vector b, Vector c, Vector d) {
	        Vector ab = b.sub(a), cd = d.sub(c);
	        int o1 = (int) Math.signum(ab.cross(c.sub(a)).z);
	        int o2 = (int) Math.signum(ab.cross(d.sub(a)).z);
	        int o3 = (int) Math.signum(cd.cross(a.sub(c)).z);
	        int o4 = (int) Math.signum(cd.cross(b.sub(c)).z);
	        if (o1 != o2 && o3 != o4) return true;
	        if (o1 == 0 && onSeg(a, b, c)) return true;
	        if (o2 == 0 && onSeg(a, b, d)) return true;
	        if (o3 == 0 && onSeg(c, d, a)) return true;
	        if (o4 == 0 && onSeg(c, d, b)) return true;
	        return false;
	    }

	    // Given 3 COLINEAR Vectors, returns if p is on the line segment a-b
	    // Add an epsilon if using doubles
	    static boolean onSeg(Vector a, Vector b, Vector p) {
	        return p.x <= Math.max(a.x, b.x) && p.x >= Math.min(a.x, b.x)
	                && p.y <= Math.max(a.y, b.y) && p.y >= Math.min(a.y, b.y);
	    }

	    // Returns a vector where p is reflected past the line l1 -> l2
	    static Vector reflect(Vector l1, Vector l2, Vector p) {
	        Vector line = l2.sub(l1);  double l = line.dot(line);
	        double t = p.sub(l1).dot(line) / l;
	        Vector q = line.scale(t).add(l1);
	        return q.add(q.sub(p));
	    }

	    // Reflects this vector across the vector n
	    Vector reflect(Vector n) {
	        n = n.normalize();
	        return sub(n.scale(2 * dot(n)));
	    }

	    //#
	    public int compareTo(Vector p) {
	        if (y == p.y) return Double.compare(x, p.x);
	        return Double.compare(y, p.y);
	    }
	    //$

	    //#
	    // Compares a and b with whichever comes first in a positive circular sweep
	    // Works best for longs
	    public static int compare(Vector a, Vector b) {
	        int res = 0;

	        if (a.x < 0) res += a.y >= 0 ? 1 : 2;
	        else if (a.y < 0) res += 3;

	        if (b.x < 0) res -= b.y >= 0 ? 1 : 2;
	        else if (b.y < 0) res -= 3;

	        if(res == 0) {
	            Vector cross = a.cross(b);  if(cross.z == 0) return 0;
	            if(cross.z > 0) return -1;  else  return 1;
	        }

	        return res;
	    }
	    //$

	    //#
	    public String toString() {
	        if(equals(x0, 0.0) && equals(y0, 0.0) && equals(z0, 0.0))
	            return String.format("<%.2f, %.2f, %.2f>", x, y, z);
	        return String.format("<%.2f + %.2ft, %.2f + %.2ft, %.2f + %.2ft>", x0, x, y0, y, z0, z);
	    } //$
	}

	static class LineSeg {
	    Vector a, b;

	    public LineSeg(Vector aa, Vector bb) {
	        a = aa;
	        b = bb;
	    }

	    public boolean pointOnLine(Vector p) {
	        Vector ap = p.sub(a);
	        Vector pb = b.sub(p);
	        return Vector.equals(ap.mag() + pb.mag(), b.sub(a).mag());
	    }

	    public boolean parallel(LineSeg l) {
	        return Vector.equals(l.b.sub(l.a).cross(b.sub(a)).mag(), 0.0);
	    }

	    public boolean parallel(Vector v) {
	        return Vector.equals(v.cross(b.sub(a)).mag(), 0.0);
	    }

	    //Returns a LineSegment rotated around point p with angle ang
	    public LineSeg rotate(Vector p, double ang) {
	        return new LineSeg(a.rotate(p, ang), b.rotate(p, ang));
	    }

	    //Checks if a Vector v from (x0, y0) to (x, y) intersects with this line segment
	    public boolean intersects(Vector v) {
	        Vector p = new Vector(a, b).intersect(v);
	        return p == null ? false : pointOnLine(p);
	    }

	    //Returns the point of intersection or null if the lines don't intersect
	    public Vector intersect(Vector v) {
	        Vector p = new Vector(a, b).intersect(v);
	        if(p == null || !pointOnLine(p)) return null;
	        return p;
	    }
	    //Checks if a Vector v from (x0, y0) to (x, y) intersects with this line segment
	    public boolean intersects(LineSeg l) {
	        Vector p = intersect(l);
	        return !(p == null);
	    }

	    //Returns the point of intersection or null if the lines don't intersect
	    public Vector intersect(LineSeg l) {
	        if(Vector.equals(a.sub(l.a).mag(), 0.0) || Vector.equals(a.sub(l.b).mag(), 0.0)) return a;
	        if(Vector.equals(b.sub(l.a).mag(), 0.0) || Vector.equals(b.sub(l.b).mag(), 0.0)) return b;
	        Vector p = new Vector(a, b).intersect(new Vector(l.a, l.b));
	        if(p == null || !pointOnLine(p) || !l.pointOnLine(p)) return null;
	        return p;
	    }

	    //#
	    public String toString() {
	        return "{ " + a + " to " + b + " }";
	    } //$
	}

	static class Polygon implements Comparable<Polygon> {
	    public ArrayList<Vector> vs; //%
	    public double area; //%

	    //# Constructs a polygon from an arraylist of vs in clockwise or counter-clockwise order
	    public Polygon(ArrayList<Vector> vss) {
	        vs = vss;
	        area = area();
	    }//$

	    //#Returns a polygon shifted over (d.x, d.y)
	    public Polygon translate(Vector d) {
	        ArrayList<Vector> nvs = new ArrayList<>(vs.size());
	        for(Vector v : vs)
	            nvs.add(v.add(d));
	        return new Polygon(nvs);
	    }//$

	    //#Returns a polygon rotated around (c.x, c.y) with angle a
	    public Polygon rotate(Vector c, double a) {
	        ArrayList<Vector> nvs = new ArrayList<>(vs.size());
	        for(Vector v : vs)
	            nvs.add(v.rotate(c, a));
	        return new Polygon(nvs);
	    }//$

	    //#Returns the area of this polygon
	    public double area() {
	        double area = 0.0;
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            area += (b.x - a.x) * (b.y + a.y);
	        }
	        return this.area = Math.abs(area) / 2.0;
	    }//$

	    public double signedArea() {
	        double area = 0.0;
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            area += (b.x - a.x) * (b.y + a.y);
	        }
	        return area / 2.0; //Do Math.abs(signedArea()) for area()
	    }

	    //#Returns the perimeter of this polygon
	    public double perimeter() {
	        double per = 0.0;
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            per += new Vector(a, b).mag();
	        }
	        return per;
	    }//$

	    //#Check if a point is INSIDE this polygon
	    public boolean pointInPolygon(Vector p) {
	        if(pointOnPerimeter(p)) return false;
	        double angle = 0.0;
	        Vector v = new Vector(p, p.add(new Vector(1d, 0d, 0d)));
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = new Vector(p, vs.get(i));
	            Vector b = new Vector(p, vs.get((i+1) % vs.size()));
	            angle += Math.atan2(a.cross(b).z, a.dot(b));
	        }
	        return Vector.equals(Math.abs(angle), Math.PI * 2.0);
	    }//$

	    //#Checks if a point is on the perimeter of this polygon
	    public boolean pointOnPerimeter(Vector p) {
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            LineSeg ab = new LineSeg(a, b);
	            if(ab.pointOnLine(p))
	                return true;
	        }
	        return false;
	    }//$

	    //#Returns the minimum distance to the given polygon
	    //Returns 0.0 if they intersect
	    public double distanceTo(Polygon poly) {
	        if(intersects(poly)) return 0.0;
	        double min = Double.MAX_VALUE;
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            for(Vector p : poly.vs)
	                min = Math.min(min, Vector.pointLineSegDist(a, b, p));
	        }
	        for(int i = 0; i < poly.vs.size(); i++) {
	            Vector a = poly.vs.get(i);
	            Vector b = poly.vs.get((i+1) % poly.vs.size());
	            for(Vector p : vs)
	                min = Math.min(min, Vector.pointLineSegDist(a, b, p));
	        }
	        return min;
	    }//$

	    //#
	    public boolean touches(Polygon poly) {
	        for(Vector p : poly.vs)
	            if(pointOnPerimeter(p))
	                return true;
	        for(Vector p : vs)
	            if(poly.pointOnPerimeter(p))
	                return true;
	        return false;
	    }//$

	    //#Returns true if the line segment INTERSECTS this polygon. Returns false if it doesn't or if their perimeters just touch
	    public boolean intersects(LineSeg l) {
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            LineSeg ab = new LineSeg(a, b);
	            if(ab.intersects(l))
	                if(!ab.pointOnLine(l.a) && !ab.pointOnLine(l.b) &&
	                   !l.pointOnLine(a) && !l.pointOnLine(b) ) //Check if they only touch
	                    return true;
	        }
	        return false;
	    }//$

	    //#Returns true if the polygon INTERSECTS with this polygon
	    public boolean intersects(Polygon poly) {
	        for(int i = 0; i < poly.vs.size(); i++) {
	            Vector a = poly.vs.get(i);
	            Vector b = poly.vs.get((i+1) % poly.vs.size());
	            LineSeg ab = new LineSeg(a, b);
	            if(intersects(ab))
	                return true;
	        }
	        return false;
	    }//$

	    //#Returns true IF this polygon entirely contains the polygon provided.
	    //Will return false in the special case that the two polygons are the same.
	    public boolean contains(Polygon poly) {
	        if(intersects(poly))
	            return false;
	        for(int i = 0; i < poly.vs.size(); i++) {
	            Vector a = poly.vs.get(i);
	            if(pointInPolygon(a))
	                return true;
	            else if(!pointOnPerimeter(a))
	                return false;
	        }
	        return true;
	    }//$

	    //# Assumes convex polygon
	    // Returns minimum width of this polygon if rotated optimally
	    public double getMinWidth() {
	        double minWidth = -1;
	        for(int i = 0; i < vs.size(); i++) {
	            Vector a = vs.get(i);
	            Vector b = vs.get((i+1) % vs.size());
	            double max = 0.0;
	            for(Vector p : vs)
	                max = Math.max(Vector.pointLineDist(a, b, p), max);
	            if(minWidth < 0) minWidth = max;
	            else minWidth = Math.min(minWidth, max);
	        }
	        return minWidth;
	    }//$

	    // Gets center of mass of this simple polygon
	    //% O(n)
	    public Vector getCentroid() {
	        double a = 0.0, cx = 0.0, cy = 0.0;
	        int n = vs.size();
	        for(int i = 0; i < n; i++) {
	            Vector va = vs.get(i);
	            Vector vb = vs.get((i + 1) % n);
	            double temp = va.x * vb.y - vb.x * va.y;
	            a += temp;
	            cx += (va.x + vb.x) * temp;
	            cy += (va.y + vb.y) * temp;
	        }
	        a *= 3.0;
	        return new Vector(cx / a, cy / a);
	    }

	    //#
	    public int compareTo(Polygon poly) {
	        return Double.compare(area, poly.area);
	    }//$
	}

	class Square {
		Vector a, b, c, d;
		LineSeg[] segs;
		Square(Vector aa, Vector bb, Vector cc, Vector dd) {
			a = aa; b = bb; c = cc; d = dd;
			segs = new LineSeg[4];
			segs[0] = new LineSeg(a, b);
			segs[1] = new LineSeg(b, c);
			segs[2] = new LineSeg(c, d);
			segs[3] = new LineSeg(d, a);
		}
		boolean contains(Vector p) {
			double side = a.sub(c).mag();
			double longest = 0;
			longest = Math.max(longest, a.sub(p).mag());
			longest = Math.max(longest, b.sub(p).mag());
			longest = Math.max(longest, c.sub(p).mag());
			longest = Math.max(longest, d.sub(p).mag());
			return longest < side;
		}
	}

	public void solve(Scanner in, PrintWriter out) {
		/*
		boolean intersects = false;
		Square a = new Square(new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()));
		Square b = new Square(new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()), new Vector(in.nextDouble(), in.nextDouble()));
		for(LineSeg s1 : a.segs) {
			for(LineSeg s2 : b.segs) {
				if(s1.intersects(s2)) {
					intersects = true;
				}
			}
		}
		System.out.println(a.contains(b.a));
		System.out.println(b.contains(a.a));
//		if(b.contains(a.a) || a.contains(b.a)) {
//			intersects = true;
//		}
		out.println(intersects ? "YES" : "NO");
		*/
		ArrayList<Vector> sq1 = new ArrayList<>();
		ArrayList<Vector> sq2 = new ArrayList<>();
		for(int i = 0; i < 4; ++i) {
			sq1.add(new Vector(in.nextDouble(), in.nextDouble()));
		}
		for(int i = 0; i < 4; ++i) {
			sq2.add(new Vector(in.nextDouble(), in.nextDouble()));
		}
		Polygon a = new Polygon(sq1);
		Polygon b = new Polygon(sq2);
		if(a.intersects(b) || a.contains(b) || b.contains(a)) {
			out.println("YES");
		} else {
			out.println("NO");
		}
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		new C().solve(in, out);
		in.close();
		out.close();
	}
}

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

public class CoverPoints{

    public static class Point{
        float x;
        float y;
        Point(int x, int y){
            this.x = (float)x;
            this.y = (float)y;
        }
    }

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        Point[] a = new Point[4];
        Point[] b = new Point[4];
        int x = 0, y = 0;
        for (int i = 0; i < 4; i++){
            x = sc.nextInt();
            y = sc.nextInt();
            a[i] = new Point(x, y);
        }
        for (int i = 0; i < 4; i++){
            x = sc.nextInt();
            y = sc.nextInt();
            b[i] = new Point(x, y);
        }
        if(isInside(a, b) || isInside(b, a))
            System.out.println("YES");
        else
            System.out.println("NO");
    }

    public static boolean isInside(Point[] a, Point[] b){
        for (int i = 0; i < 4; i++){
            float tarea = 0;
            for (int j = 0; j < 4; j++){
                int k = (j+1)%4;
                tarea += triangle(b[i], a[j], a[k]);
            }
            float rarea = recangle(a);
            if(rarea == tarea) return true;
        }
        return false;
    }

    public static float recangle(Point[] vertex){
        return triangle(vertex[0], vertex[1], vertex[2]) + triangle(vertex[2], vertex[3], vertex[0]);
    }

    public static float triangle(Point a, Point b, Point c){
        return Math.abs((a.x*(b.y - c.y)+ b.x*(c.y - a.y)+ c.x*(a.y - b.y))/2);
    }

    public static class FastScanner{
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(){
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try{
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong(){
            return Long.parseLong(next());
        }

        double nextDouble(){
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try{
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.util.*;
import java.lang.Math.*;

public class Solution{

    static int[] n = new int[2];

    public static String solve(int[][] a, int[][] b) {
        int[][] amap = iteratea(a, (a[1][0]-a[0][0]+1)*(a[1][0]-a[0][0]+1));

        if(check(amap, b, n)){return "YES";}
        else{return "NO";}
    }

    private static Boolean check(int[][] a, int[][] b, int[] n){
        for(int i=0;i<a.length;i++){
            if(dist(a[i],n)<dist(b[0],n)){return true;}
        }
        return false;
    }

    private static int[][] iteratea(int[][] a, int n){
        int[][] region = new int[n][2];
        int k=0;
        for(int i=a[0][1];i<=a[2][1];i++){
            for(int j=a[0][0];j<=a[1][0];j++){
                region[k][0]=j;
                region[k][1]=i;
                k++;
            }
        }
        return region;
    }

    private static double dist(int[] a, int[] b){
        return Math.sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]));
    }

    private static int[][] transforma(int[][] a){
        int[] x_axis=new int[4];
        int[] y_axis=new int[4];
        int[][] square = new int[4][2];

        for(int i=0;i<4;i++){
            x_axis[i] = a[i][0];
            y_axis[i] = a[i][1];
        }

        int[] A= new int[]{getMin(x_axis), getMin(y_axis)};
        int[] B= new int[]{getMax(x_axis), getMin(y_axis)};
        int[] C= new int[]{getMax(x_axis), getMax(y_axis)};
        int[] D= new int[]{getMin(x_axis), getMax(y_axis)};

        square[0][0] = A[0];
        square[0][1] = A[1];
        square[1][0] = B[0];
        square[1][1] = B[1];
        square[2][0] = C[0];
        square[2][1] = C[1];
        square[3][0] = D[0];
        square[3][1] = D[1];

        return square;
    }

    private static int[][] transformb(int[][] b){
        int[] x_axis=new int[4];
        int[] y_axis=new int[4];
        int[][] square = new int[4][2];

        for(int i=0;i<4;i++){
            x_axis[i]=b[i][0];
            y_axis[i]=b[i][1];
        }

        int[] A= new int[]{getMin(x_axis), (getMax(y_axis)-getMin(y_axis))/2+getMin(y_axis)};
        int[] B= new int[]{(getMax(x_axis)-getMin(x_axis))/2+getMin(x_axis), getMax(y_axis)};
        int[] C= new int[]{getMax(x_axis), (getMax(y_axis)-getMin(y_axis))/2+getMin(y_axis)};
        int[] D= new int[]{(getMax(x_axis)-getMin(x_axis))/2+getMin(x_axis), getMin(y_axis)};

        n[0] = (getMax(x_axis)-getMin(x_axis))/2+getMin(x_axis);
        n[1] = (getMax(y_axis)-getMin(y_axis))/2+getMin(y_axis);

        square[0][0] = A[0];
        square[0][1] = A[1];
        square[1][0] = B[0];
        square[1][1] = B[1];
        square[2][0] = C[0];
        square[2][1] = C[1];
        square[3][0] = D[0];
        square[3][1] = D[1];

        return square;
    }

    public static int getMax(int[] inputArray){
        int maxValue = inputArray[0];
        for(int i=1;i < inputArray.length;i++){
            if(inputArray[i] > maxValue){
                maxValue = inputArray[i];
            }
        }
        return maxValue;
    }

    public static int getMin(int[] inputArray){
        int minValue = inputArray[0];
        for(int i=1;i<inputArray.length;i++){
        if(inputArray[i] < minValue){
            minValue = inputArray[i];
            }
        }
        return minValue;
    }

    private static void unrap(int[][] a){
        for(int i=0;i<a.length;i++){
            System.out.println("============");
            for(int j=0;j<2;j++){
                System.out.println(a[i][j]);
            }
        }
    }

    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);

        int[][] a = new int[4][2];
        int[][] b = new int[4][2];

        for(int i=0;i<4;i++){
            for(int j=0;j<2;j++){
                a[i][j]=scan.nextInt();
            }
        }
        for(int i=0;i<4;i++){
            for(int j=0;j<2;j++){
                b[i][j]=scan.nextInt();
            }
        }
        System.out.println(solve(transforma(a),transformb(b)));
    }
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        new Solver().run(1);
    }
}

class Solver {

    private BufferedReader reader = null;
    private StringTokenizer st = null;

    private Point[][] points = new Point[4][4];
    private boolean intersectionFound = false;

    public void run(int inputType) throws Exception {
        if (inputType == 0)
            reader = new BufferedReader(new FileReader("input.txt"));
        else
            reader = new BufferedReader(new InputStreamReader(System.in));

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < 4; ++i) {
            points[0][i] = new Point(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < 4; ++i) {
            points[1][i] = new Point(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
        }

        for (int i = 0; i < 2; ++i) {
            for (int j = 0; j < 4; ++j) {

                int nextSq = (i + 1) % 2;
                int res1 = crossProductSign(points[nextSq][0], points[nextSq][1], points[i][j]);
                int res2 = crossProductSign(points[nextSq][1], points[nextSq][2], points[i][j]);
                int res3 = crossProductSign(points[nextSq][2], points[nextSq][3], points[i][j]);
                int res4 = crossProductSign(points[nextSq][3], points[nextSq][0], points[i][j]);

                if ((res1 == 0 && inside(points[nextSq][0], points[nextSq][1], points[i][j]))
                        || (res2 == 0 && inside(points[nextSq][1], points[nextSq][2], points[i][j]))
                        || (res3 == 0 && inside(points[nextSq][2], points[nextSq][3], points[i][j]))
                        || (res4 == 0 && inside(points[nextSq][3], points[nextSq][0], points[i][j]))) {

                    intersectionFound = true;
                    break;
                }

                if (res1 == res2 && res2 == res3 && res3 == res4) {
                    intersectionFound = true;
                    break;
                }
            }

            if (intersectionFound)
                break;
        }

        if (!intersectionFound) {

            for (int i = 0; i < 4; ++i) {

                boolean res1 = inside(points[0][0], points[0][1], points[1][i]);
                boolean res2 = inside(points[0][1], points[0][2], points[1][(i + 1) % 4]);
                boolean res3 = inside(points[0][2], points[0][3], points[1][(i + 2) % 4]);
                boolean res4 = inside(points[0][3], points[0][0], points[1][(i + 3) % 4]);

                if (res1 && res2 && res3 && res4) {
                    intersectionFound = true;
                    break;
                }
            }
        }

        if (intersectionFound)
            System.out.println("YES");
        else
            System.out.println("NO");

        reader.close();
    }

    boolean inside(Point p1, Point p2, Point p3) {
        int xhigh = Math.max(p2.x, p1.x);
        int xlow = Math.min(p2.x, p1.x);
        int yhigh = Math.max(p2.y, p1.y);
        int ylow = Math.min(p2.y, p1.y);

        return p3.x >= xlow && p3.x <= xhigh && p3.y >= ylow && p3.y <= yhigh;
    }

    int crossProductSign(Point p1, Point p2, Point p3) {
        int res = (p2.x - p1.x) * (p3.y - p1.y) - (p2.y - p1.y) * (p3.x - p1.x);

        if (res < 0)
            return -1;

        if (res > 0)
            return 1;

        return 0;
    }

    class Point {
        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by Arihant Jain on 6/16/2018.
 */
public class twoSquares {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String out[] = br.readLine().split(" ");
        int parallelX[] = new int[4];
        int parallelY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            parallelX[i/2] = Integer.parseInt(out[i])+100;
            parallelY[i/2] = Integer.parseInt(out[i+1])+100;
        }
        int x1 = Math.min(parallelX[0],parallelX[2]);
        int x2 = Math.max(parallelX[0], parallelX[2]);
        int y1 = Math.min(parallelY[0],parallelY[2]);
        int y2 = Math.max(parallelY[0], parallelY[2]);
        out = br.readLine().split(" ");
        int diagonalGivenX[] = new int[4];
        int diagonalGivenY[] = new int[4];
        for (int i =0; i<8; i+=2) {
            diagonalGivenX[i/2] = Integer.parseInt(out[i])+100;
            diagonalGivenY[i/2] = Integer.parseInt(out[i+1])+100;
        }
        int xMin = 0;
        int xMax = 0;
        int yMin = 0;
        int yMax = 0;
        for (int i =1; i<4; i++) {
            if (diagonalGivenX[i]<diagonalGivenX[xMin])
                xMin = i;
            if (diagonalGivenX[i]>diagonalGivenX[xMax])
                xMax = i;
            if (diagonalGivenY[i]<diagonalGivenY[yMin])
                yMin = i;
            if (diagonalGivenY[i]>diagonalGivenY[yMax])
                yMax = i;
        }
        int[] diagonalX = new int[4];
        int[] diagonalY = new int[4];
        diagonalX[0] = diagonalGivenX[xMin];
        diagonalX[1] = diagonalGivenX[yMax];
        diagonalX[2] = diagonalGivenX[xMax];
        diagonalX[3] = diagonalGivenX[yMin];
        diagonalY[0] = diagonalGivenY[xMin];
        diagonalY[1] = diagonalGivenY[yMax];
        diagonalY[2] = diagonalGivenY[xMax];
        diagonalY[3] = diagonalGivenY[yMin];
        for (int i =0; i<4; i++) {
            if (diagonalX[i]>=x1 && diagonalX[i]<= x2 && diagonalY[i]>=y1 && diagonalY[i]<=y2) {
                System.out.println("YES");
                return;
            }
        }
        for (int i =0; i<4; i++) {
            int x = parallelX[i];
            int y = parallelY[i];
            if (y<=x+diagonalY[0]-diagonalX[0] && y<=-1*x+diagonalX[1]+diagonalY[1] && y>=x-diagonalX[2]+diagonalY[2] && y>=-1*x+diagonalX[3]+diagonalY[3]) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

import java.util.*;
public class TwoSquares {
    public static final double EPS = 1e-7;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] sq1X = new int[4];
        int[] sq1Y = new int[4];
        int[] sq2X = new int[4];
        int[] sq2Y = new int[4];
        for(int i = 0; i < 4; i++) {
            sq1X[i] = scanner.nextInt();
            sq1Y[i] = scanner.nextInt();
        }
        for(int i = 0; i < 4; i++) {
            sq2X[i] = scanner.nextInt();
            sq2Y[i] = scanner.nextInt();
        }
        Arrays.sort(sq1X);
        Arrays.sort(sq2Y);
        Arrays.sort(sq1Y);
        Arrays.sort(sq2X);
        //print(sq1X);
        //print(sq1Y);
        //print(sq2X);
        //print(sq2Y);
        //if (sq1X[0] == sq2X[0] || sq1X[0] == sq2X[3] || sq1X[3] == sq2X[0] || sq1X[3] == sq2X[3] ||
              //  sq1Y[0] == sq2Y[0] || sq1Y[0] == sq2Y[3] || sq1Y[3] == sq2Y[0] || sq1Y[3] == sq2Y[3]) {
            //System.out.println("Yes");
          //  System.exit(0);
        //}
        if (((sq1X[0] >= sq2X[0] && sq1X[0] <= sq2X[3]) && (sq1Y[0]<=sq2Y[3] && sq1Y[3]>=sq2Y[0])) ||
                (sq1X[3] >= sq2X[0] && sq1X[3] <= sq2X[3]) && (sq1Y[0]<=sq2Y[3] && sq1Y[3] >= sq2Y[0]) ||
                (sq2X[0] >= sq1X[0] && sq2X[0] <= sq1X[3]) && (sq2Y[0]<=sq1Y[3] && sq2Y[3] >= sq1Y[0]) ||
                (sq2X[3] >= sq1X[0] && sq2X[3] <= sq1X[3]) && (sq2Y[0]<=sq1Y[3] && sq2Y[3] >= sq1Y[0])){
            System.out.println("Yes");

        }
        else {
            System.out.println("NO");
        }
    }
    public static void print(int[] arr) {
        StringBuilder stringBuilder = new StringBuilder();
        for(int i = 0; i < 4; i++) {
            stringBuilder.append(arr[i]);
            stringBuilder.append(" ");
        }
        System.out.println(stringBuilder.toString());
    }
}

import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class C {

	static StringBuilder st = new StringBuilder();

		public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Point [] square = new Point [4] ;
		Point [] rotSquare = new Point[4] ;

		for(int i = 0 ; i < 4 ;i++)
			square[i] = new Point(sc.nextInt() , sc.nextInt());

		for(int i = 0 ; i < 4 ;i++)
			rotSquare[i] = new Point(sc.nextInt() , sc.nextInt());

		boolean can = false ;

		for(int x = -100 ; x <= 100 ; x++)
			for(int y = -100 ; y <= 100 ; y++)
				can |= inside(new Point(x , y), square) & inside(new Point (x , y), rotSquare);

		out.println(can ? "YES" : "NO");

		out.flush();
		out.close();

	}
	static int crossProduct(Point a , Point b)
	{
		int ans = a.x * b.y - a.y * b.x ;

		if(ans <= 0)return -1 ;
		return 1 ;
	}

	static boolean inside(Point a , Point [] points)
	{
		boolean allPos = true ;
		boolean allNeg = true ;

		for(int i = 0 ; i < 4 ; i++)
		{
			Point v1 = new Point (points[i].x - a.x , points[i].y - a.y) ;
			Point v2 = new Point (points[(i + 1) % 4].x - a.x , points[(i + 1) % 4].y - a.y) ;

			allPos &= crossProduct(v1, v2) > 0;
			allNeg &= crossProduct(v1, v2) < 0;
		}
		return allPos | allNeg ;

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws Exception {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());

			return st.nextToken();
		}

		int nextInt() throws Exception {
			return Integer.parseInt(next());
		}

		long nextLong() throws Exception {
			return Long.parseLong(next());
		}

		double nextDouble() throws Exception {
			return Double.parseDouble(next());
		}

	}

	static void shuffle(int[] a) {
		int n = a.length;
		for (int i = 0; i < n; i++) {
			int r = i + (int) (Math.random() * (n - i));
			int tmp = a[i];
			a[i] = a[r];
			a[r] = tmp;
		}
	}

}