#include <cstdio>
#include <cstring>

int main() {
    //freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    int t;
    char s1[100], s2[100];
    scanf("%d", &t);
    while (t--) {
        scanf("%s %s", s1, s2);
        int k = strlen(s1) - strlen(s2);
        if (k > 0)
            printf("%s is longer than %s\n", s1, s2);
        else
            printf("%s %s %s\n", s1, 0 == k ? "is equal long to" : "is shorter than", s2);
    }
    return 0;
}

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