Rectange inclusion

Write a program that reads a sequence of rectangle pairs, and for each
pair, states whether one rectangle fits inside the other. A rectangle R1
fits inside another R2 if the width of R1 is smaller or equal than the
witdh of R2, and the same happens with its height. A rectangle R1 also
may fit inside another R2 after rotating R1 90 degrees (i.e. exchanging
its width and height)

Input

The input is a sequence of pairs of rectangles. Each rectangle in a pair
is given as two integer numbers w,h corresponding to its width and
height.

Output

The output is, for each pair of rectangles, whether the first rectangle
fits inside the second, the second inside the first, or no fitting is
possible. Follow the format of the examples.

Problem information

Author: Lluís Padró

Generation: 2026-01-25T16:02:46.516Z

© Jutge.org, 2006–2026.
https://jutge.org
