Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart.

Let us consider the building process. Vasya takes a brick and puts it on top of the already built tower so that the sides of the brick are parallel to the sides of the bricks he has already used. Let's introduce a Cartesian coordinate system on the horizontal plane, where Vasya puts the first brick. Then the projection of brick number i on the plane is a square with sides parallel to the axes of coordinates with opposite corners in points (xi, 1, yi, 1) and (xi, 2, yi, 2). The bricks are cast from homogeneous plastic and the weight of a brick a × a × a is a3 grams.

It is guaranteed that Vasya puts any brick except the first one on the previous one, that is the area of intersection of the upper side of the previous brick and the lower side of the next brick is always positive.

We (Vasya included) live in a normal world where the laws of physical statics work. And that is why, perhaps, if we put yet another brick, the tower will collapse under its own weight. Vasya puts the cubes consecutively one on top of the other until at least one cube loses the balance and falls down. If it happens, Vasya gets upset and stops the construction. Print the number of bricks in the maximal stable tower, that is the maximal number m satisfying the condition that all the towers consisting of bricks 1, 2, ..., k for every integer k from 1 to m remain stable.

Input

The first input file contains an integer n (1 ≤ n ≤ 100) which is the number of bricks. Each of the next n lines contains four numbers xi, 1, yi, 1, xi, 2, yi, 2 (xi, 1 ≠ xi, 2, |xi, 1 - xi, 2| = |yi, 1 - yi, 2|) which are the coordinates of the opposite angles of the base of the brick number i. The coordinates are integers and their absolute value does not exceed 50. 

The cubes are given in the order Vasya puts them. It is guaranteed that the area of intersection of the upper side of the brick number i - 1 and the lower side of the brick number i is strictly strictly greater than zero for all i ≥ 2.

Output

Print the number of bricks in the maximal stable tower.

Examples

Input

2
0 0 3 3
1 0 4 3


Output

2


Input

2
0 0 3 3
2 0 5 3


Output

1


Input

3
0 0 3 3
1 0 4 3
2 0 5 3


Output

3
import java.util.*;
import static java.lang.Math.*;

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

    void run(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int lim = n;
        C[] tbl = new C[n];
        double z = 0;
        for(int i = 0; i < n; i++){
            int x1 = sc.nextInt();
            int y1 = sc.nextInt();
            int x2 = sc.nextInt();
            int y2 = sc.nextInt();
            tbl[i] = new C(min(x1, x2), min(y1, y2),
                           max(x1, x2), max(y1, y2), z);
            z += tbl[i].len;
            if(i > 0 && !tbl[i-1].overlap(tbl[i])){
                lim = i;
                break;
            }
        }

        int cur = 1;
        /*
        double cm = tbl[0].m;
        double cx = tbl[0].gx * tbl[0].m;
        double cy = tbl[0].gy * tbl[0].m;
        double cz = tbl[0].gz * tbl[0].m;
        */
        for(cur = 1; cur < lim; cur++){
            /*
            cm += tbl[cur].m;
            cx += tbl[cur].gx * tbl[cur].m;
            cy += tbl[cur].gy * tbl[cur].m;
            cz += tbl[cur].gz * tbl[cur].m;
            double gx = cx / cm;
            double gy = cy / cm;
            double gz = cz / cm;
            System.out.printf("gx = %.2f, gy = %.2f, gz = %.2f\n", gx, gy, gz);
            */
            double cm = 0, cx = 0, cy = 0;
            boolean ok = true;
            for(int i = cur; i > 0; i--){
                cm += tbl[i].m;
                cx += tbl[i].gx * tbl[i].m;
                cy += tbl[i].gy * tbl[i].m;
                double gx = cx / cm;
                double gy = cy / cm;
                ok &= tbl[i-1].containsxy(gx, gy);
            }
            if(!ok)break;
        }
        System.out.println(cur);
    }
}

class C {
    double x1, y1, x2, y2, z1, z2;
    double gx, gy, gz;
    double len;
    double m;
    C(int a, int b, int c, int d, double z){
        x1 = a;
        y1 = b;
        x2 = c;
        y2 = d;
        len = abs(x2 - x1);
        m = len * len * len;
        z1 = z;
        z2 = z + len;
        gx = (x1 + x2) / 2.0;
        gy = (y1 + y2) / 2.0;
        gz = z + len / 2.0;
    }
    boolean containsxy(double x, double y){
        return x1 <= x && x <= x2 && y1 <= y && y <= y2;
    }
    boolean contains(double x, double y, double z){
        return x1 <= x && x <= x2 && y1 <= y && y <= y2 && z1 <= z && z <= z2;
    }
    boolean overlap(C c){
        if(((x1 <= c.x1 && c.x1 <= x2) || (c.x1 <= x1 && x1 <= c.x2)) &&
           ((y1 <= c.y1 && c.y1 <= y2) || (c.y1 <= y1 && y1 <= c.y2)))
            return true;
        return false;
    }
}
