#include <bits/stdc++.h>
using namespace std;

bool isnum(char c) {
    return '0' <= c && c <= '9';
}

void solve(string s0, string s1) {
    if (s0 == s1) {
        cout << "+" << endl;
        return;
    }
    int pos = 0;
    while (1) {
        if (pos == s0.size() && pos < s1.size()) {
            cout << "+" << endl;
            return;
        }
        if (pos == s1.size() && pos < s0.size()) {
            cout << "-" << endl;
            return;
        }
        if (pos == s1.size() && pos == s0.size()) {
            cout << "+" << endl;
            return;
        }
        if (isnum(s0[pos]) && !isnum(s1[pos])) {
            cout << "+" << endl;
            return;
        }
        if (!isnum(s0[pos]) && isnum(s1[pos])) {
            cout << "-" << endl;
            return;
        }
        if (!isnum(s0[pos]) && !isnum(s1[pos])) {
            if (s0[pos] < s1[pos]) {
                cout << "+" << endl;
                return;
            }
            if (s0[pos] > s1[pos]) {
                cout << "-" << endl;
                return;
            }
            pos++;
            continue;
        }

        int p1 = pos, p0 = pos;
        while (1) {
            p0++;
            if (p0 > s0.size() || !isnum(s0[p0])) break;
        }
        while (1) {
            p1++;
            if (p1 > s1.size() || !isnum(s1[p1])) break;
        }
        if (p0 > p1) {
            cout << "-" << endl;
            return;
        }
        if (p0 < p1) {
            cout << "+" << endl;
            return;
        }
        for (int k = pos; k < p0; k++) {
            if (s0[k] < s1[k]) {
                cout << "+" << endl;
                return;
            }
            if (s0[k] > s1[k]) {
                cout << "-" << endl;
                return;
            }
        }
        pos = p0;
    }
    cout << "+" << endl;
}

int main(int argc, char *argv[]) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    for (int i = 0; i < n; i++) {
        string ss;
        cin >> ss;
        solve(s,ss);
    }
    return 0;
}

