|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|2 초||512 MB||0||0||0||0.000%|
Taking a train can be such a stressful experience! You have to find the best price for your ticket, find the right station, get there on time, find the right hall and track, etc. Laurie has managed to do all of this, and the last step is to get into the right coach. Each coach has a number, but the exact manner in which coaches are numbered is a secret known only to the train company. The only rule is that coaches are numbered by consecutive positive integers, but we do not know where the numbering starts and ends, and in which direction it goes. For instance, here are two valid ways to number the coaches of a train with four coaches:
Laurie has just arrived on the platform in front of one of the coaches, and only knows the number of that coach, and how many coaches are to the left and right. Of course, Laurie needs to find one specific coach, whose number is written on the train ticket. Your job is to tell Laurie what to do next, among four possible actions:
Gfor “Get in”: get into the coach, if Laurie happens to be in front of the right coach;
Lfor “Left”: if we know that Laurie’s coach is necessarily to the left;
Rfor “Right”: if we know that Laurie’s coach is necessarily to the right;
Efor “Explore”: if we do not have enough information to know in which direction Laurie’s coach is, so that Laurie will have to figure it out by trial and error.
For example, consider the following situation: Laurie is in front of coach 1337, there are five coaches to the left and two coaches to the right:
If Laurie is looking for coach 1340, then necessarily it must be to the left. However, if Laurie is looking for coach 1339, then we do not have information to conclude.
The input file consists of multiple test cases. The first line of the input file consists of a single integer indicating the number of test cases. Each test case follows, and consists of one single line that consists of four integers l, r, n, and m, each separated by a single space:
It is guaranteed that, for each test case, there is at least one way to number the coaches of the train with consecutive positive integers which is consistent with what Laurie is seeing and with what Laurie’s train ticket indicates.
For each test case in the input, your program should produce one line which consists of exactly one character (followed by a newline): the character should be
E, depending on what Laurie should do. There should be no blank lines in your output.
5 1 2 11 11 0 3 42 40 5 2 1337 1339 5 2 1337 1340 10 10 11 1
G R E L E