@digits = ["0","1","2","3","4","5","6","7","8","9"]

def make_array str
    mode, arr, s = 0, [], ""
    str.each_char{|c|
        if @digits.include?(c)
            if mode == 0
                mode = 1
                arr << s
                s = ""
            end
        else
            if mode == 1
                mode = 0
                arr << s.to_i
                s = ""
            end
        end
        s += c
    }
    case mode
    when 0 then arr << s
    when 1 then arr << s.to_i
    end
    return arr
end

n = gets.to_i
s0 = gets.chomp
arr0 = make_array(s0)

n.times{
    i, result, arr1 = 0, "+", make_array(gets.chomp)
    if arr0 != arr1
        while true
            if arr0[i].nil? || arr1[i].nil?
                result = "-" if arr1[i].nil?
                break
            elsif arr0[i].class != arr1[i].class
                result = "-" if arr0[i].class == String
                break
            elsif arr0[i] != arr1[i]
                result = "-" if arr0[i] > arr1[i]
                break
            end
            i += 1
        end
    end
    puts result
}


