program prob2
    implicit none
    character(110) :: a, b
    integer :: i, la, lb
    logical :: ans, decide
    read(*,*) a, b
    la = len_trim(a)
    lb = len_trim(b)
    decide = .false.
    if(la > lb) then
        ans = .true.
        decide = .true.
    else if(la < lb) then
        decide = .true.
        ans = .false.
    else
        do i = 1, la
            if(a(i:i) > b(i:i))then
                decide = .true.
                ans = .true.
                exit
            else if(a(i:i) < b(i:i)) then
                decide = .true.
                ans = .false.
                exit
            else
                cycle
            end if
        end do
    end if

    if(decide .eqv. .false.) then
        write(*,*) 'EQUAL'
    else
        if(ans .eqv. .true.) then
            write(*,*) 'GREATER'
        else
            write(*,*) 'LESS'
        end if
    end if

    stop
contains
end program prob2