Pyramid Trap
Difficulty: Hard

A team called Archaeologists of the Central Mountains (ACM) is interested in the famous Helmut's Pyramid (HP) in Egypt. In the Pyramid, there is a Sarcophagus of Umbertiti Nefrites (SUN). According to the legend, the Sarcophagus contains (besides the pharaoh's body, of course) a priceless treasure: air-tickets to Orlando, FL, with the magic date March 2000. The ACM decided to locate this treasure and retrieve it from the Pyramid before it is too late. The problem is that the Pyramid is equipped with many varied traps to protect the tickets from being stolen. Many years of intensive study have been spent monitoring activities inside the Pyramid and discovering all the traps. Finally, the archaeologists are ready to enter the Pyramid. They have a very powerful notebook to help them finish their task. And your task is to provide the software for them.

There is a large room in the Pyramid called Room-of-No-Return. Its floor is covered by rectangular tiles of equal size. The name of the room was chosen because of the very high number of traps and mechanisms in it. The ACM group has spent several years studying the secret plan of this room. It has made a clever plan to avoid all the traps. A specially trained mechanic was sent to deactivate the most feared trap called Shattered Bones. After deactivating the trap the mechanic had to escape from the room. It is very important to step on the center of the tiles only; he must not touch the edges. One wrong step and a large rock falls from the ceiling squashing the mechanic like a pancake. After deactivating the trap, he realized a horrible thing: the ACM plan did not take his equipment box into consideration. The box must be laid onto the ground because the mechanic must have both hands free to prevent contact with other traps. But when the box is laid on the ground, it could touch the line separating the tiles. And this is the main problem you are to solve.

**Input Specification:**

The input consists of T test cases. The number of them (T) is given on the first line of the input file. Each test case consists of a single line. The line contains exactly four integer numbers separated by spaces: A, B, X and Y. A and Bindicate the dimensions of the tiles, X and Y are the dimensions of the equipment box (1 <= A,B,X,Y <= 50000).

**Output Specification:**

Your task is to determine whether it is possible to put the box on a single tile -- that is, if the whole box fits on a single tile without touching its border. If so, you are to print one line with the sentence "Escape is possible.". Otherwise print the sentence "Box cannot be dropped.".

**Sample Input:**  

2  
10 10 8 8  
8 8 10 10  

**Output for the Sample Input:**  

Escape is possible.  
Box cannot be dropped.  


Input Format:

Output Format:

Sample Input:

Sample Output:

Python 3 starter code:


Reference solution (C++):
	#define TEXT_YES "Escape is possible.\n"
	#define TEXT_NO "Box cannot be dropped.\n"

	#include <stdio.h>
	#include <math.h>

	int main()
	{
  	/* number of tasks */
  	unsigned int N;
  	/* sides of rectangles */
  	unsigned int A, B, C, D;
  	/* diagonals */
  	double X, Y;
  	/* distances of intersection */
  	double K, L;
  	/* the longest possible shorter side of the inner rectangle */
  	double DMax;

  	scanf("%d", &N);
  	for (; N > 0; N--)
  	{
    /*
     * Read in the data
     */

    /* the first (outer) and the second (inner) rectangle */
    scanf("%d %d %d %d", &A, &B, &C, &D);
    /* first, normalize rectangles to one single case (A >= B, C >= D) */
    if (A < B)
    {
      unsigned int tmp = A;
      A = B;
      B = tmp;
    }
    if (C < D)
    {
      unsigned int tmp = C;
      C = D;
      D = tmp;
    }

    /*
     * Next, compute whether the rectangles can be put together
     */

    /* trivial case */
    if (A > C && B > D)
      printf(TEXT_YES);
    else
      if (D >= B)
        printf(TEXT_NO);
      else
      {
        /* outer rectangle's diagonal */
        X = sqrt((double)A * (double)A + (double)B * (double)B);
        /* inner rectangle's diagonal */
        Y = sqrt((double)C * (double)C + (double)D * (double)D);
        /* check for marginal conditions */
        if (Y < B)
          printf(TEXT_YES); /* the inner rectangle can freely rotate inside */
        else
          if (Y > X)
            /* there is no way how to put inner rectangle inside of the outer
               one with the diagonal of the inner longer than the diagonal of
               the outer */
            printf(TEXT_NO);
          else
          {
            /*
             * now, we compute intersection of inner rectangle's diagonal and
             * sides of the outer one
             */
            /* distance between the closest corner and the intersection */
            L = (B - sqrt(Y * Y - (double)A * (double)A)) / 2;
            /* distance of the same corner and the second intersection */
            K = (A - sqrt(Y * Y - (double)B * (double)B)) / 2;
            /* maximal possible shorter side of the inner rectangle with give
               diagonal */
            DMax = sqrt(L * L + K * K);
            /* if the actual side is longer, rectangles do not pass, but
               they pass otherwise */
            if (D >= DMax)
              printf(TEXT_NO);
            else
              printf(TEXT_YES);
          }
      }
  	}
 	 return 0;
	}