import scala.io.StdIn
import scala.annotation.tailrec

object Main extends App {
  val a = StdIn.readLine
  val b = StdIn.readLine

  val ans = {
    if(a.length > b.length) "GREATER"
    else if(a.length < b.length) "LESS"
    else {
      val ita = a.reverseIterator
      val itb = b.reverseIterator

      @tailrec
      def rec(cha:Char, chb:Char):String = {
        if(cha > chb) "GREATER"
        else if(cha < chb) "LESS"
        else if(!ita.hasNext) "EQUAL"
        else rec(ita.next, itb.next)
      }

      rec(ita.next, itb.next)
    }
  }

  println(ans)
}