#include <bits/stdc++.h>
#include <atcoder/lazysegtree>

using namespace std;
using namespace atcoder;

int sigma = 26;

int op_ord(int x, int y) { return x + y; }
int e_ord() { return 0; }
int mapping_ord(int f, int x) { return (f + x) % sigma; }
int composition_ord(int f, int g) { return (f + g) % sigma; }
int id_ord() { return 0; }

int main() {
    string s, t;
    cin >> s >> t;

    int min_st = min(s.size(), t.size());

    vector<int> ord_s(s.size() + 1);
    for (int i = 0; i < s.size(); i++) {
        ord_s[i] = (int)(s[i] - 'a');
    }
    ord_s[s.size()] = -1;
    
    vector<int> ord_t(t.size() + 1);
    for (int i = 0; i < t.size(); i++) {
        ord_t[i] = (int)(t[i] - 'a');
    }
    ord_t[t.size()] = -1;

    lazy_segtree<int, op_ord, e_ord, int, mapping_ord, composition_ord, id_ord> seg_s(ord_s);
    lazy_segtree<int, op_ord, e_ord, int, mapping_ord, composition_ord, id_ord> seg_t(ord_t);

    int q;
    cin >> q;

    while (q--) {
        int cmd;
        cin >> cmd;

        if (cmd == 1) {
            int l, r, x;
            cin >> l >> r >> x;

            seg_s.apply(l - 1, min(r, min_st), x);

        } else if (cmd == 2) {
            int l, r, x;
            cin >> l >> r >> x;

            seg_t.apply(l - 1, min(r, min_st), x);

        } else {
            int p;
            cin >> p;

            bool checked = false;

            for (int i = p - 1; i <= min_st; i++) {
                int ord_s = seg_s.get(i);
                int ord_t = seg_t.get(i);
                
                if (ord_s > ord_t) {
                    cout << "Greater" << endl;
                    checked = true;
                    break;
                } else if (ord_s < ord_t) {
                    cout << "Lesser" << endl;
                    checked = true;
                    break;
                }
            }

            if (!checked) {
                cout << "Equals" << endl;
            }
            
        }
    }
}