#include <stdio.h>
#include <string.h>

int main()
{
	int n,a,b;
	char str1[100],str2[100];
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",str1);
		scanf("%s",str2);
		a=strlen(str1);
		b=strlen(str2);
		if(a > b)
		printf("%s is longer than %s\n",str1,str2);
		if(a == b)
		printf("%s is equal long to %s\n",str1,str2);
		if(a < b)
		printf("%s is shorter than %s\n",str1,str2);	
	}
}

/**************************************************************
	Problem: 2216
	User: admin
	Language: C
	Result: Accepted
	Time:9 ms
	Memory:1144 kb
****************************************************************/