implicit none
character(101) :: a,b
integer :: na, nb, ia, ib, i

read *,a
read *,b

na = len_trim(a)
nb = len_trim(b)

if (na > nb) then
   print '(a)','GREATER'
   stop
else if (na < nb) then
   print '(a)','LESS'
   stop
else
   do i = 1,na
      read(a(i:i),*) ia
      read(b(i:i),*) ib
      if (ia > ib) then
         print '(a)','GREATER'
         stop
      else if (ia < ib) then
         print '(a)','LESS'
         stop
      endif
   enddo
endif

print '(a)','EQUAL'
stop
end