import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    fs <- init <$> getLine
    sn <- getLine
    if (length fs) == (length sn)
        then case compare fs sn of
            LT -> putStrLn "LESS"
            EQ -> putStrLn "EQUAL"
            GT -> putStrLn "GREATER"
            otherwise -> putStrLn "BUG"
        else case compare (length fs) (length sn) of
            LT -> putStrLn "LESS"
            EQ -> putStrLn "EQUAL"
            GT -> putStrLn "GREATER"
            otherwise -> putStrLn "BUG"
