#include <bits/stdc++.h>

using namespace std;

using pii = pair<int, int>;
using ll = long long;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)
#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

#define pb push_back
#define mp make_pair
#define ft first
#define sd second

int n;
string s[1003];

bool comp(string a, string b, int k) { // a > b
  if(b.length() == k) {
    return (a.length() > k);
  }else if(a.length() == k)return false;

  if('0' <= b[k] && b[k] <= '9') {
    if('0' <= a[k] && a[k] <= '9') {
      int na = 0, nb = 0, j = 0;
      for(j=k;'0' <= a[j] && a[j] <= '9';++j)na = na*10 +(a[j]-'0');
      for(j=k;'0' <= b[j] && b[j] <= '9';++j)nb = nb*10 +(b[j]-'0');
      if(na > nb)return true;
      else if(na < nb)return false;
      else return comp(a, b, j);
    }else return true;
  }else if('0' <= a[k] && a[k] <= '9') return false;
  else {
    if(a[k] > b[k])return true;
    else if(a[k] < b[k])return false;
  }
  return comp(a, b, k+1);
}

int main(){
  cin.tie(0);cout.tie(0);
  ios_base::sync_with_stdio(false);

  cin >> n;
  rep(i, n+1)cin >> s[i];

  rep(i, n)cout << ( comp(s[0], s[i+1], 0) ? '-' : '+' ) << endl;

	return 0;
}

