import java.util.Scanner;
public class TwoRectangle {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter r1's center x-, y-coordinates, width, and height:");
double r1CenterX = input.nextDouble();
double r1CenterY = input.nextDouble();
double r1Width = input.nextDouble();
double r1Height = input.nextDouble();
System.out.print("Enter r2's cneter x-, y-coordinates, width, and height:");
double r2CenterX = input.nextDouble();
double r2CenterY = input.nextDouble();
double r2Width = input.nextDouble();
double r2Height = input.nextDouble();
double r1MaxDistance = Math.sqrt(r1Width * r1Width + r1Height * r1Height) / 2;
double r2MaxDistance = Math.sqrt(r2Width * r2Width + r2Height * r2Height) / 2;
double insideMaxDistance = r1MaxDistance - r2MaxDistance;
double overLapsMaxDistance = r1MaxDistance + r2MaxDistance;
double r2ToR1Distance = Math.sqrt(Math.abs((r1CenterX - r2CenterX) * (r1CenterX - r2CenterX))
+ Math.abs((r1CenterY - r2CenterY) * (r1CenterY - r2CenterY)));
if(r2ToR1Distance <= insideMaxDistance)
System.out.println("r2 is inside r1");
else if(r2ToR1Distance <= overLapsMaxDistance)
System.out.println("r2 overlaps r1 ");
else
System.out.println("r2 does not overlap r1");
}
}