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

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

bool check(string &s0) {
	string s; cin >> s;
	for(int i = 0; i < min(s0.size(), s.size()); ++i) {
		if(num(s0[i]) and num(s[i])) {
			int num0 = 0;
			for(int j = i; j < (int)s0.size() and num(s0[j]); ++j) {
				num0 *= 10;
				num0 += (s0[j] - '0');
			}
			int num1 = 0;
			for(int j = i; j < (int)s.size() and num(s[j]); ++j) {
				num1 *= 10;
				num1 += (s[j] - '0');
			}
			if(num0 == num1) {
				continue;
			}
			return (num0 < num1);
		}
		if(s0[i] != s[i]) {
			return (s0[i] < s[i]);
		}
	}
	return (s0.size() <= s.size());
}

int main() {
	int n; cin >> n;
	string s0; cin >> s0;
	while(n--) {
		if(check(s0)) {
			cout << '+' << '\n';
		} else {
			cout << '-' << '\n';
		}
	}
	return 0;
}

