#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int N,LEN_BASE;
char BASE[100];
char TMP[100];

bool is_num(char ch){

	return ch >= '0' && ch <= '9';
}

int main(){

	scanf("%d",&N);

	scanf("%s",BASE);
	for(LEN_BASE = 0; BASE[LEN_BASE] != '\0'; LEN_BASE++);

	int tmp_length;
	int base_index,tmp_index;
	ll num_base,num_tmp;
	bool FLG;

	for(int i = 0; i < N; i++){

		scanf("%s",TMP);
		for(tmp_length = 0; TMP[tmp_length] != '\0'; tmp_length++);

		FLG = false;

		for(int k = 0; k < min(tmp_length,LEN_BASE); k++){

			if(is_num(BASE[k]) && is_num(TMP[k])){

				num_base = 0;
				for(base_index = k;base_index < LEN_BASE && is_num(BASE[base_index]) == true; base_index++){

					num_base = 10*num_base+BASE[base_index]-'0';
				}

				num_tmp = 0;
				for(tmp_index = k;tmp_index < tmp_length && is_num(TMP[tmp_index]) == true; tmp_index++){

					num_tmp = 10*num_tmp+TMP[tmp_index]-'0';
				}

				if(num_base < num_tmp){

					printf("+\n");
					FLG = true;
					break;

				}else if(num_base > num_tmp){

					printf("-\n");
					FLG = true;
					break;
				}


			}else if(BASE[k] != TMP[k]){

				if(BASE[k] < TMP[k]){

					printf("+\n");
				}else{

					printf("-\n");
				}
				FLG = true;
				break;
			}
		}

		if(FLG)continue;

		if(LEN_BASE <= tmp_length){

			printf("+\n");

		}else{

			printf("-\n");
		}
	}

	return 0;
}

