#include<bits/stdc++.h>

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
typedef struct aaaaa{
  int x,y,t;
}Grid;
using namespace std;
ll toint(string s){
  ll kake=1;
  ll ret=0;
  for(int i=s.size()-1;i>=0;i--){
    ret+=kake*(s[i]-'0');
    kake*=10;
  }
  return ret;
}
int main(){
  int n;cin>>n;
  string str;cin>>str;
  for(int i=0;i<n;i++){
    string s;cin>>s;
    if(s==str){
      cout<<"+"<<endl;
      continue;
    }
      bool flag=true;
      int win=-1;
      for(int i=0;i<min(str.size(),s.size());i++){
	if(!flag)continue;
	if(isdigit(str[i])&&isdigit(s[i])){
	  string str2="";
	  int po=i;
	  while(isdigit(str[po]))
	    str2+=str[po++];
	  string s2="";
	  int po2=i;
	  while(isdigit(s[po2]))
	    s2+=s[po2++];
	  if(toint(str2)>toint(s2)){
	    cout<<"-"<<endl;
	    //cout<<toint(str2)<<" "<<toint(s2)<<endl;
	    flag=false;
	  }else if(toint(str2)<toint(s2)){
	    cout<<"+"<<endl;
	    flag=false;
	  }
	}else if(isdigit(str[i])){
	  cout<<"+"<<endl;
	  flag=false;
	}else if(isdigit(s[i])){
	  cout<<"-"<<endl;
	  flag=false;
	}else{
	  if(str[i]>s[i]){
	    cout<<"-"<<endl;
	    flag=false;
	  }else if(str[i] < s[i]){
	    cout<<"+"<<endl;
	    flag=false;
	  }
	}
      }
      if(flag){
	if(str.size()>s.size())
	  cout<<"-"<<endl;
	else
	  cout<<"+"<<endl;
      }
    
  }
  return 0;
}

