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>
/*
Keep solving problems.
*/

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

public class CFA {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    private static final long MOD = 1000 * 1000 * 1000 + 7;
    private static final int[] dx = {0, -1, 0, 1};
    private static final int[] dy = {1, 0, -1, 0};
    private static final String yes = "Yes";
    private static final String no = "No";

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

        @Override
        public String toString() {
            return x + " " + y;
        }
    }
    void solve() throws IOException {
        int n = 4;
        Point[] sq1 = new Point[n];
        Point[] sq2 = new Point[n];
        for (int i = 0; i < n; i++) {
            int x = nextInt();
            int y = nextInt();
            sq1[i] = new Point(x, y);
        }
        for (int i = 0; i < n; i++) {
            int x = nextInt();
            int y = nextInt();
            sq2[i] = new Point(x, y);
        }

        for (Point p : sq2) {
            if (check1(sq1, p)) {
                outln(yes.toUpperCase());
                return;
            }
        }

        for (Point p : sq1) {
            if (check2(sq2, p)) {
                outln(yes.toUpperCase());
                return;
            }
        }

        int mx = sq2[0].x + sq2[2].x;
        int my = sq2[0].y + sq2[2].y;
        outln(check4(sq1, new Point(mx, my)) ? yes.toUpperCase() : no.toUpperCase());
    }

    boolean check1(Point[] sq1, Point p) {
        int minx = Integer.MAX_VALUE;
        int maxx = Integer.MIN_VALUE;
        int miny = Integer.MAX_VALUE;
        int maxy = Integer.MIN_VALUE;
        for (Point cur : sq1) {
            minx = Math.min(minx, cur.x);
            maxx = Math.max(maxx, cur.x);
            miny = Math.min(miny, cur.y);
            maxy = Math.max(maxy, cur.y);
        }

        return p.x >= minx && p.x <= maxx && p.y >= miny && p.y <= maxy;
    }

    boolean check4(Point[] sq1, Point p) {
        int minx = Integer.MAX_VALUE;
        int maxx = Integer.MIN_VALUE;
        int miny = Integer.MAX_VALUE;
        int maxy = Integer.MIN_VALUE;
        for (Point cur : sq1) {
            minx = Math.min(minx, cur.x);
            maxx = Math.max(maxx, cur.x);
            miny = Math.min(miny, cur.y);
            maxy = Math.max(maxy, cur.y);
        }

        return p.x >= 2 * minx && p.x <= 2 * maxx && p.y >= 2 * miny && p.y <= 2 * maxy;
    }

    boolean check2(Point[] sq2, Point p) {
        int par1 = check3(sq2[0], sq2[3], p);
        int par2 = check3(sq2[1], sq2[2], p);
        int par3 = check3(sq2[0], sq2[1], p);
        int par4 = check3(sq2[3], sq2[2], p);
        return (1L * par1 * par2 <= 0 && 1L * par3 * par4 <= 0);
    }

    int check3(Point p1, Point p2, Point p) {
        int slope = (p2.y - p1.y) / (p2.x - p1.x);
        return slope * (p.x - p1.x) + (p1.y - p.y);
    }

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

    long gcd(long a, long b) {
        while(a != 0 && b != 0) {
            long c = b;
            b = a % b;
            a = c;
        }
        return a + b;
    }

    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    private void formatPrint(double val) {
        System.out.format("%.9f%n", val);
    }
    public CFA() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CFA();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}