#include <cstdio>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
using namespace std;

char a[10005], b[10005];
int main()
{
	int lena, lenb, flag = 1;
	gets(a);
	gets(b);
	lena = strlen(a);
	lenb = strlen(b);
	for(int i = 0; i != max(lena, lenb); i++)
	{
		if(a[i] > b[i])
		{
			printf("GREATER\n");
			break;
		}
		else if(a[i] < b[i])
		{
			printf("LESS\n");
			break;
		}
		else
		{
			flag = 0;
			continue;
		}
	}
	if(flag == 0)
	{
		printf("EQUAL\n");
	}
}