When a person presses the button to go into an elevator, the elevator on the nearest floor will travel to the user's floor and open its doors. You are tasked to determine which elevator out of two will open its doors for the person that presses the button.
Input Specification
There are three types of floors in the building: The main floors, the ground floor, and the parking floor. There will be three lines of input, all of them being a character that denotes the floors. The main floors are integers in the range of 1-9
. The ground floor, below the main floors, is represented by the letter G
. Finally, the parking floor, the lowest floor, is represented by the letter P
.
The first line is the floor that the button for the elevator was pressed.
The second and third lines are the floors where the first and second elevator are, respectively.
Output Specification
Print out the number of the elevator that will open for the passenger: for the first elevator, for the second elevator, or, if both are equally as close, print instead.
Sample Input
3
4
1
Sample Output
1
Comments