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

#define rep(i,n) for(int (i)=0;(i)<n;(i)++)

int main(){
  int N;
  cin>>N;
  vector<string> S(N+1);
  rep(i,N+1) cin>>S[i];

  vector<char> ans(N+1,'n');
  for(int i=1;i<=N;i++){
    for(int j=0;j<min(S[0].size(),S[i].size());j++){
      if(S[i][j]>='0'&&S[i][j]<='9'){
        if(S[0][j]>='0'&&S[0][j]<='9'){
          int val0=0,vali=0;
          int k=j;
          for(;k<S[0].size();k++){
            if(S[0][k]>='0'&&S[0][k]<='9'){
              val0=val0*10+S[0][k]-'0';
            }else break;
          }
          k=j;
          for(;k<S[i].size();k++){
            if(S[i][k]>='0'&&S[i][k]<='9'){
              vali=vali*10+S[i][k]-'0';
            }else break;
          }
          if(val0<vali) ans[i]='+';
          else if(val0>vali) ans[i]='-';
          j=k-1;
        }else ans[i]='-';
      }else if(S[0][j]>='0'&&S[0][j]<='9') ans[i]='+';
      else if(S[0][j]<S[i][j]) ans[i]='+';
      else if(S[i][j]<S[0][j]) ans[i]='-';
      
      if(ans[i]!='n') break;
    }
    if(ans[i]=='n'){
      if(S[i].size()<S[0].size()) ans[i]='-';
      else ans[i]='+';
    }
  }

  for(int i=1;i<=N;i++) cout<<ans[i]<<endl;
}
