#!/usr/bin/env pypy3 def compare(a, b): if a == b: return 0 else: return (a - b) // abs(a - b) # 入力チェック用 assert つき def main(): n = int(input()) assert compare(1, n) != 1 and compare(n, 10) != 1 for _ in range(n): a, b = (int(x) for x in input().split()) assert compare(1, a) != 1 and compare(a, 10 ** 8) != 1 assert compare(1, b) != 1 and compare(b, 10 ** 8) != 1 c = compare(a, b) if c == 1: print("G") elif c == 0: print("E") else: print("L") if __name__ == '__main__': main()