object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val a = inputs(0)
  val b = inputs(1)

  println(solve(a, b))

  private def solve(a: String, b: String): String = {
    val as = a.size
    val bs = b.size
    if(as > bs) {
      return "GREATER"
    } else if (bs < as){
      return "LESS"
    } else {
      (0 until as).foreach { i =>
        val ac = a.indexOf(i).toInt
        val bc = b.indexOf(i).toInt

        if(ac > bc) {
          return "GREATER"
        } else if (bc < ac){
          return "LESS"
        }
      }

      return "EQUAL"
    }
  }
}