===

 1 /*
 2 ID: luopengting
 3 PROG: ride
 4 LANG: C++
 5 */
 6 #include <iostream>
 7 #include <cstdio>
 8 #include <cstring>
 9 #include <fstream>
10 using namespace std;
11 const int Mod = 47;
12 int main()
13 {
14     freopen("ride.in","r",stdin);
15     freopen("ride.out","w",stdout);
16 
17     char s1[10], s2[10];
18     scanf("%s %s", s1, s2);
19     int len1 = strlen(s1);
20     int len2 = strlen(s2);
21     int res1 = 1, res2 = 1;
22     for(int i = 0; i < len1; i++)
23     {
24         int t = s1[i] - 'A' + 1;
25         res1 = res1 * t % Mod;
26     }
27     for(int i = 0; i < len2; i++)
28     {
29         int t = s2[i] - 'A' + 1;
30         res2 = res2 * t % Mod;
31     }
32     if(res1 == res2)
33     {
34         printf("GO\n");
35     }
36     else
37     {
38         printf("STAY\n");
39     }
40     return 0;
41 }