/* ID: zhangzz4 PROG: ride LANG: C++ */ /* ID: zhangzz4 PROG: ride LANG: C++ */ #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { freopen("ride.in","r",stdin); freopen("ride.out","w",stdout); char s1[7],s2[7]; int n1=1,n2=1; scanf("%s%s",s1,s2); for(int i=0;s1[i];i++) n1*=(s1[i]-'A'+1); for(int i=0;s2[i];i++) n2*=(s2[i]-'A'+1); puts((n1-n2)%47?"STAY":"GO"); }