program ABC059B
    implicit none
    integer(8)::i
    character(100)::A,B
    integer(8)::flg=0
    read(5,*)A,B

    if(len_trim(A)>len_trim(B))then
        flg=1
    else if(len_trim(A)<len_trim(B))then
        flg=2
    else
        do i=1,len_trim(A)
            if(ichar(A(i:i))>ichar(B(i:i)))then
                flg=1
                exit
            else if(ichar(A(i:i))<ichar(B(i:i)))then
                flg=2
                exit
            end if
        end do
    end if

    if(flg==1)then
        print'(A)',"GREATER"
    else if(flg==2)then
        print'(A)',"LESS"
    else
        print'(A)',"EQUAL"
    end if
end program ABC059B