include "string.h"
#include "stdlib.h"
#include "stdio.h"
int main()
{
char input[10] = {'\0'};
int max[3] = {0};
int s=0,s1=0,s2=0;
while (fgets(input,10,stdin)!= NULL) {
getchar();
int len = strlen(input) ;
for (int i = 0; i < len ; i++) {
if (input[i] > max[0] && input[i] > max[1]) {
max[0] = input[i];
}else if (input[i] <= max[0] && input[i] >= max[1]) {
max[1] = input[i];
}
}
s = (max[0] - '0') * (max[0] - '0') + (max[1] - '0') * (max[1] - '0');
s1 = input[6] * 100 + input[7] * 10 + input[8] * 1 - '0' * 111;
if (s == s1) {
printf("Good Morning!\n");
}
else {
printf("SPY!\n");
}
s1 = 0, s2 = 0,s=0;
for (int i = 0; i < 2; i++) {
max[i] = 0;
}
}
}