#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ull d[100000],dp[100][100];

#define MAX_DIGITS 100000 //1e+5 -> 100,000
#define DIGITS 8
#define MOD 100000000 //1e+8
#define ERROR_OVER_FLOW 1e+3

typedef struct{
  bool sign;
  int digit;
  int number[MAX_DIGITS];
}multinum;

multinum *multisubtraction(multinum *num1,multinum *num2,bool pass);

extern void multiswap(multinum *num1,multinum *num2){
  multinum *index = (multinum*)malloc(sizeof(multinum));
  *index = *num1;
  *num1 = *num2;
  *num2 = *index;
  free(index);
}

static void change_sign(multinum *num,bool change = false){
  if(num->sign){
    if(num->number[MAX_DIGITS - num->digit] < 0){
      num->number[MAX_DIGITS - num->digit] *= -1;
    }
  }else{
    if(num->number[MAX_DIGITS - num->digit] > 0){
      num->number[MAX_DIGITS - num->digit] *= -1;
    }
  }
  if(change){
    num->sign = (num->sign) ? false : true;
  }
}

static void restore_sign(multinum *num,bool change = false){
  if(num->sign){
    if(num->number[MAX_DIGITS - num->digit] > 0){
      num->number[MAX_DIGITS - num->digit] *= -1;
    }
  }else{
    if(num->number[MAX_DIGITS - num->digit] < 0){
      num->number[MAX_DIGITS - num->digit] *= -1;
    }
  }
  if(change){
    num->sign = (num->sign) ? false : true;
  }
}

extern bool multiequal(multinum *num1,multinum *num2){
  for(int i = MAX_DIGITS;i > 0;i--){
    if(num1->number[i] != num2->number[i])return false;
  }
  return true;
}

extern bool multibig(multinum *num1,multinum *num2){
  if(!num1->sign && num2->sign)return false;
  if(num1->digit < num2->digit)return false;
  else if(num1->digit == num2->digit){
    if(num1->number[MAX_DIGITS - num1->digit] < num2->number[MAX_DIGITS - num2->digit]){
      return false;
    }
  }
  return true;
}

extern multinum* multiclear(multinum *num = NULL){
  multinum *multi;
  multi = (multinum*)malloc(sizeof(multinum));
  if(multi == NULL){
    printf("Couldn't secure.");
    return NULL;
  }
  multi->sign = false;
  multi->digit = 1;
  for(int i = 0;i < MAX_DIGITS;i++){
    multi->number[i] = 0;
  }
  if(num != NULL)num = multi;
  return multi;
}

// String型からint型への変換
extern multinum* multiconvert(string strnum){
  multinum *num = multiclear();
  if(num == NULL)return NULL;
  if(strnum.size() > DIGITS * MAX_DIGITS){
    printf("< TOO LARGE >\n");
    return NULL;
  }
  //桁数計算
  if(strnum[0] == '-'){
    if((1 < strnum.size() % DIGITS && strnum.size() % DIGITS <= 8))num->digit = strnum.size() / 8 + 1;
    else num->digit = strnum.size() / 8;
  }else{
    if(1 <= strnum.size() && (0 < strnum.size() % DIGITS && strnum.size() % DIGITS <= 7))num->digit = strnum.size() / 8 + 1;
    else num->digit = strnum.size() / 8;
  }
  //値の確定
  for(int i = 0;i < strnum.size();i++){
    if(strnum[strnum.size() - i -1] == '-'){
      //マイナスの場合は sign = true
      num->sign = true;
      if(num->number[MAX_DIGITS - num->digit] != 0)num->number[MAX_DIGITS - num->digit] *= -1;
      else num->number[MAX_DIGITS - num->digit + 1] *= -1;
      break;
    }
    num->number[MAX_DIGITS - (i / DIGITS) - 1] += pow(10,(i % DIGITS)) * (strnum[strnum.size() - i - 1] - '0');
  }
  // cout << "Digits of Number : " << DIGITS * num->digit << endl;
  return num;
}

static void check_state(multinum *num){
  printf("sign:%s\n",num->sign ? "true" : "false");
  printf("first:%d\n",num->number[MAX_DIGITS - num->digit]);
}

extern void multiprint(multinum *num){
  if(num == NULL){
    puts("NULL Pointer");
    return;
  }
  // check_state(num);
  for(int i = MAX_DIGITS - num->digit;i < MAX_DIGITS;i++){
    printf("%08d ",num->number[i]);
  }
  printf("\n");
}

//２数の符号が同じ場合だけ
//それ以外は、（正の数）＋（負の数）-> （正の数）ー（正の数）
extern multinum* multiaddition(multinum *num1,multinum *num2,bool pass = false){
  multinum *ans = multiclear();
  short cut = 0;
  bool sign = false;
  bool swaped = false;
  //subtractionからの呼び出しは直前の処理まで飛ばす
  if(pass)goto processing;
  //（負の数）＋（正の数）＝（正の数）ー（正の数）
  //（正の数）＋（負の数）＝（正の数）ー（正の数）
  if(num1->sign != num2->sign){
    if(num1->sign){
      change_sign(num1,true);
      if(!multibig(num1,num2)){
        swaped = true;
        multiswap(num1,num2);
      }
      ans = multisubtraction(num1,num2,true);
      if(swaped){
        multiswap(num1,num2);
        change_sign(ans,true);
      }
      restore_sign(num1,true);
      change_sign(ans,true);
    }else{
      change_sign(num2,true);
      if(!multibig(num1,num2)){
        swaped = true;
        multiswap(num1,num2);
      }
      ans = multisubtraction(num1,num2,true);
      if(swaped){
        multiswap(num1,num2);
        change_sign(ans,true);
      }
      restore_sign(num2,true);
    }
    return ans;
  }
  //２数の符号が一緒の時
  processing:;
  if(num1->sign && num2->sign){
    sign = true;
    num1->number[MAX_DIGITS - num1->digit] *= -1;
    num2->number[MAX_DIGITS - num2->digit] *= -1;
  }
  for(int i = MAX_DIGITS - 1 ;i >= 0;i--){
    //これ以上計算できない
    if(MAX_DIGITS - i > num1->digit && MAX_DIGITS - i > num2->digit)break;
    ans->number[i] += (num1->number[i] + num2->number[i] + cut);
    if(i == 0)break;
    if(ans->number[i] < MOD){
      cut = 0;
    }else{
      cut = 1;
      ans->number[i] -= MOD;
    }
  }
  if(ans->number[0] > MOD){
    printf("< OVER FLOW >");
    return NULL;
  }
  for(int i = 0;i < MAX_DIGITS;i++){
    if(ans->number[i] != 0){
      ans->digit = MAX_DIGITS - i;
      if(sign){
        ans->sign = true;
        ans->number[i] *= -1;
        num1->number[MAX_DIGITS - num1->digit] *= -1;
        num2->number[MAX_DIGITS - num2->digit] *= -1;
      }
      break;
    }
  }
  return ans;
}

extern multinum* multisubtraction(multinum *num1,multinum *num2,bool pass = false){
  multinum *ans = multiclear();
  short cut = 0;
  bool swaped = false;
  //additionからの呼び出しは直前の処理まで飛ばす
  if(pass)goto processing;
  //符号が違う場合
  if(num1->sign != num2->sign){
    if(num1->sign){
      change_sign(num1);
      ans = multiaddition(num1,num2,true);
      restore_sign(num1);
      change_sign(ans);
      return ans;
    }else{
      change_sign(num2);
      ans = multiaddition(num1,num2,true);
      restore_sign(num2);
      return ans;
    }
  }
  //大きい数 - 小さい数
  if(num1->sign && num2->sign){
    change_sign(num1);
    change_sign(num2);
    if(!multibig(num1,num2)){
      swaped = true;
      multiswap(num1,num2);
    }
    ans = multisubtraction(num1,num2,true);
    if(swaped){
      multiswap(num1,num2);
      change_sign(ans,true);
    }
    restore_sign(num1);
    restore_sign(num2);
    change_sign(ans,true);
    return ans;
  }
  //符号が同じ場合
  processing:;
  if(!multibig(num1,num2)){
    swaped = true;
    multiswap(num1,num2);
  }
  for(int i = MAX_DIGITS - 1 ;i >= 0;i--){
    //これ以上計算できない
    if(MAX_DIGITS - i > num1->digit && MAX_DIGITS - i > num2->digit)break;
    ans->number[i] = (num1->number[i] - num2->number[i] - cut);
    if(MAX_DIGITS - i > num1->digit - 1 && MAX_DIGITS - i > num2->digit - 1)break;
    if(ans->number[i] >= 0){
      cut = 0;
    }else{
      cut = 1;
      ans->number[i] += MOD;
    }
  }
  if(ans->number[0] < -MOD){
    printf("< UNDER FLOW >");
    return NULL;
  }
  for(int i = 0;i < MAX_DIGITS;i++){
    if(ans->number[i] != 0){
      ans->digit = MAX_DIGITS - i;
      break;
    }
  }
  //符号確定、桁数
  if(swaped){
    multiswap(num1,num2);
    if(!multibig(num1,num2))change_sign(ans);
  }
  return ans;
}

int main(){
  multinum *num1 = multiclear();
  multinum *num2 = multiclear();
  cin >> s >> t;
  num1 = multiconvert(s);
  num2 = multiconvert(t);
  if(multiequal(num1,num2))puts("EQUAL");
  else if(multibig(num1,num2))puts("GREATER");
  else puts("LESS");
  return 0;
}

Measured memory_bytes: 1920