Option Infer On
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim A = NextString()
        Dim B = NextString()

        WriteLine(New String() {"GREATER", "LESS", "EQUAL"}(Judge(A, B)))
    End Sub

    Function Judge(A As String, B As String) As Integer
        Select Case A.Length - B.Length
            Case > 0
                Return 0
            Case < 0
                Return 1
            Case Else
                For i = 0 To A.Length - 1
                    Select Case Asc(A(i)) - Asc(B(i))
                        Case > 0
                            Return 0
                        Case < 0
                            Return 1
                    End Select
                Next
        End Select
        Return 2
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module
