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.

Input

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.

Output

Print "Yes" if squares intersect, otherwise print "No".

You can print each letter in any case (upper or lower).

Examples

Input

0 0 6 0 6 6 0 6
1 3 3 5 5 3 3 1


Output

YES


Input

0 0 6 0 6 6 0 6
7 3 9 5 11 3 9 1


Output

NO


Input

6 0 6 6 0 6 0 0
7 4 4 7 7 10 10 7


Output

YES

Note

In 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:

<image> <image> <image>
//  package CFpracHim;
/**
 * @Author : lucent868
 * @Date : 5/10/21
 * @Time : 12:42 PM
 */

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

public class TwoSquaresCF {
    static InputReader in;
    static PrintWriter w;

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

    public static void solve() {
        in = new InputReader(System.in);
        w = new PrintWriter(System.out);


        int x1 = in.nextInt(), y1 = in.nextInt(), x2 = in.nextInt(), y2 = in.nextInt(),
                x3 = in.nextInt(), y3 = in.nextInt(), x4 = in.nextInt(), y4 = in.nextInt() ;

        int a1 = in.nextInt(), b1 = in.nextInt(), a2 = in.nextInt(), b2 = in.nextInt(),
                a3 = in.nextInt(), b3 = in.nextInt(), a4 = in.nextInt(), b4 = in.nextInt() ;


        if(area(a1,b1,a2,b2,x1,y1) +area(a2,b2,a3,b3,x1,y1) +area(a3,b3,a4,b4,x1,y1) +area(a4,b4,a1,b1,x1,y1)  == rec_area(a1,b1,a2,b2,a3,b3,a4,b4) )
        {
            w.println("YES");
            return;

        }
        if(area(a1,b1,a2,b2,x2,y2) +area(a2,b2,a3,b3,x2,y2) +area(a3,b3,a4,b4,x2,y2) +area(a4,b4,a1,b1,x2,y2)  == rec_area(a1,b1,a2,b2,a3,b3,a4,b4) )
        {
            w.println("YES");
            return;

        }
        if(area(a1,b1,a2,b2,x3,y3) +area(a2,b2,a3,b3,x3,y3) +area(a3,b3,a4,b4,x3,y3) +area(a4,b4,a1,b1,x3,y3)  == rec_area(a1,b1,a2,b2,a3,b3,a4,b4) )
        {
            w.println("YES");
            return;

        }
        if(area(a1,b1,a2,b2,x4,y4) +area(a2,b2,a3,b3,x4,y4) +area(a3,b3,a4,b4,x4,y4) +area(a4,b4,a1,b1,x4,y4)  == rec_area(a1,b1,a2,b2,a3,b3,a4,b4) )
        {
            w.println("YES");
            return;

        }
        if(area(x1,y1,x2,y2,a2,b2) +area(x2,y2,x3,y3,a2,b2) +area(x3,y3,x4,y4,a2,b2) +area(x4,y4,x1,y1,a2,b2)  == rec_area(x1,y1,x2,y2,x3,y3,x4,y4) )
        {
            w.println("YES");
            return;

        }
        if(area(x1,y1,x2,y2,a3,b3) +area(x2,y2,x3,y3,a3,b3) +area(x3,y3,x4,y4,a3,b3) +area(x4,y4,x1,y1,a3,b3)  == rec_area(x1,y1,x2,y2,x3,y3,x4,y4) )
        {
            w.println("YES");
            return;

        }
        if(area(x1,y1,x2,y2,a4,b4) +area(x2,y2,x3,y3,a4,b4) +area(x3,y3,x4,y4,a4,b4) +area(x4,y4,x1,y1,a4,b4)  == rec_area(x1,y1,x2,y2,x3,y3,x4,y4) )
        {
            w.println("YES");
            return;

        }
        if(area(x1,y1,x2,y2,a1,b1) +area(x2,y2,x3,y3,a1,b1) +area(x3,y3,x4,y4,a1,b1) +area(x4,y4,x1,y1,a1,b1)  == rec_area(x1,y1,x2,y2,x3,y3,x4,y4) )
        {
            w.println("YES");
            return;

        }


        //special
        if(area(x1,y1,x2,y2,(a1+a3)/2.0,(b1+b3)/2.0) +area(x2,y2,x3,y3,(a1+a3)/2.0,(b1+b3)/2.0) +area(x3,y3,x4,y4,(a1+a3)/2.0,(b1+b3)/2.0) +area(x4,y4,x1,y1,(a1+a3)/2.0,(b1+b3)/2.0)  == rec_area(x1,y1,x2,y2,x3,y3,x4,y4) )
        {
            w.println("YES");
            return;

        }
        if(area(a1,b1,a2,b2,(x1+x3)/2.0,(y1+y3)/2.0) +area(a2,b2,a3,b3,(x1+x3)/2.0,(y1+y3)/2.0) +area(a3,b3,a4,b4,(x1+x3)/2.0,(y1+y3)/2.0) +area(a4,b4,a1,b1,(x1+x3)/2.0,(y1+y3)/2.0)  == rec_area(a1,b1,a2,b2,a3,b3,a4,b4) )
        {
            w.println("YES");
            return;

        }


        w.println("NO");
//        return;






/*





        //top-right && bottom-left
        int max = Integer.MIN_VALUE;
        max = x1+y1;
        int xx2 = x1, yy2 = y1;

        if(max<x2+y2)
        {
            xx2 = x2;
            yy2 = y2;
            max = x2+y2;
        }

        if(max<x3+y3)
        {
            xx2 = x3;
            yy2 = y3;
            max = x3+y3;
        }

        if(max<x4+y4)
        {
            xx2 = x4;
            yy2 = y4;
            max = x4+y4;
        }

        int min = Integer.MAX_VALUE;
        min = x1+y1;
        int xx1 = x1, yy1 = y1;

        if(min>x2+y2)
        {
            xx1 = x2;
            yy1 = y2;
            min = x2+y2;
        }

        if(min>x3+y3)
        {
            xx1 = x3;
            yy1 = y3;
            min = x3+y3;
        }

        if(min>x4+y4)
        {
            xx1 = x4;
            yy1 = y4;
            min = x4+y4;
        }














        int f=0;

        int s = Math.abs(a1-a2);

        int incx,incy;

        incx = a1>a2?-1:1;
        incy = b1>b2?-1:1;

        for(int i=a1,j=b1;i!=a2+incx;i+=incx,j+=incy)
        {
//          w.println(i+" "+j);
            if(  FindPoint(xx1,yy1,xx2,yy2,i,j))
            {
                f=1;
                break;
            }
        }
//      w.println();

        incx = a2>a3?-1:1;
        incy = b2>b3?-1:1;

        for(int i=a2,j=b2;i!=a3+incx;i+=incx,j+=incy)
        {
//            w.println(i+" "+j);
            if(  FindPoint(xx1,yy1,xx2,yy2,i,j))
            {
                f=1;
                break;
            }

        }
//w.println();

        incx = a3>a4?-1:1;
        incy = b3>b4?-1:1;

        for(int i=a3,j=b3;i!=a4+incx;i+=incx,j+=incy)
        {
//            w.println(i+" "+j);
            if(  FindPoint(xx1,yy1,xx2,yy2,i,j))
            {
                f=1;
                break;
            }

        }
//w.println();
        incx = a4>a1?-1:1;
        incy = b4>b2?-1:1;

        for(int i=a4,j=b4;i!=a1+incx;i+=incx,j+=incy)
        {

//            w.println(i+" "+j);
            if(  FindPoint(xx1,yy1,xx2,yy2,i,j))
            {
                f=1;
                break;
            }


        }






        w.println(f==1?"YES":"NO");


        w.flush();
        w.close();*/
    }


    static boolean FindPoint(int x1, int y1, int x2,
                             int y2, int x, int y)
    {
        if (x >= x1 && x <= x2 &&
                y >= y1 && y <= y2)
            return true;

        return false;
    }

    static double area(double Ax,double Ay,double Bx,double By,double Cx,double Cy)
    {
//        int a = Math.abs( (Bx * Ay - Ax * By) + (Cx * By - Bx * Cy) + (Ax * Cy - Cx * Ay) ) / 2;
        double a = (Ax*(By -Cy) + Bx*(Cy -Ay) + Cx*(Ay - By))/2.0;


//        w.println(Math.abs(a));
        return Math.abs(a);
    }

    static  double rec_area(int ax, int ay, int bx, int by,int cx, int cy,int dx, int dy)
    {
        double s1 = ((ax-bx)*(ax-bx) + (ay-by)*(ay-by));
//        int s2 = Math.abs(ay - by);

//         w.println(s1);
//         w.println();
        return s1;
    }







    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, 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() {
            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 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 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 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 int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

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

        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);
        }
    }
}








