#P7031. Divide the Cake with Candles
Divide the Cake with Candles
Divide the Cake with Candles
Two students, Adam and Anton, celebrate their two-year anniversary of not passing their Math \(Logic\) exam by buying a rectangular cake with integer dimensions and two candles. Adam places the candles at two distinct integer points on the cake and gives Anton a knife to cut the cake.
The cut must satisfy the following conditions:
- The cut starts and ends at integer points on the edges of the cake.
- The cut must not pass through either candle.
- Each resulting piece must contain exactly one candle.
Find any valid cut represented by two points on the cake's boundary that divides the cake into two parts, with one candle in each piece.
For example, consider a \(7 \times 3\) cake with candles at \((2,2)\) and \((3,2)\). One valid cut is from \((2,0)\) to \((3,3)\).
inputFormat
The input consists of three lines:
- The first line contains two integers \(w\) and \(h\) denoting the width and height of the cake.
- The second line contains two integers \(x_1\) and \(y_1\) indicating the coordinates of the first candle.
- The third line contains two integers \(x_2\) and \(y_2\) indicating the coordinates of the second candle.
outputFormat
Output four integers \(x_a, y_a, x_b, y_b\) representing the starting and ending points of the cut. These points must lie on the boundary of the cake, and the straight line connecting them should separate the two candles into different pieces without touching either candle.
sample
7 3
2 2
3 2
2 0 3 3