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

bool isNumber(char c) {
	return '0' <= c and c <= '9';
}

int main()
{
	int N; cin >> N;
	vector<vector<pair<bool, string>>> ts(N+1);
	for (int i = 0; i < N+1; ++i) {
		string s; cin >> s;
		vector<pair<bool, string>> tmp;
		tmp.push_back({isNumber(s[0]), s.substr(0, 1)});
		for (int j = 1; j < s.size(); ++j) {
			if (tmp.back().first == isNumber(s[j])) {
				tmp.back().second += s[j];
			} else {
				tmp.push_back({isNumber(s[j]), s.substr(j, 1)});
			}
		}
		ts[i] = tmp;	
	}
	
	for (int i = 1; i < N+1; ++i) {
		//cout << i << endl;
		bool less = true, eq = true;
		for (int j = 0; j < ts[i].size(); ++j) {
			if (j >= ts[0].size()) {
				less = false;
				eq = false;
				break;
			}
			auto t0 = ts[0][j], tj = ts[i][j];
			if (t0.first == tj.first) {
				if (t0.first) {
					if (stoi(t0.second) == stoi(tj.second)) continue;
					less = stoi(t0.second) > stoi(tj.second); 
				} else {
					if (t0.second == tj.second) continue;
					less = t0.second > tj.second;
				}
			} else {
				less = t0.first == 0;			
			}
			eq = false;
			break;
		}
		if (eq and ts[0].size() == ts[i].size()) {
			less = false;
		}		
		if (less) cout << "-" << endl;
		else cout << "+" << endl;
	}
	return 0;
}
