#include using namespace std; /* uvwxyzabcdefghijklmnopqrst 5 apple banana banana blueberry apple watermelon vegetable banana apple ap */ string s; // uvwxyzabcdefghijklmnopqrst 给定的字典序 char get(char x) { // x=a-->g b--->h return s.find(x) + 'a'; } string change(string s1) { string s2; for (int i = 0; i < s1.size(); i++) s2 += get(s1[i]); return s2; } int main() { cin >> s; int m; cin >> m; while (m--) { string s1, s2; cin >> s1 >> s2; if (change(s1) < change(s2)) //s1==s2 => red cout << "green" << endl; else cout << "red" << endl; } return 0; }