CODEM1 - Problem1

Addition is the first elementary operation that we learn in the field of mathematics. So given some numbers we can calculate their sum and we say this is the upper limit of the sum of given numbers. For example upper limit of sum of two numbers say 2, 4 is 6. But now to make it interesting and yet simple You will be provided three numbers and all you have to do is tell whether the finite upper limit / lower limit is possible. Seems easy though there is a twist!!, Bhavik forgets the values but remembers only the sign of the numbers so given only their signs and no other conditions between the numbers can you tell if finite upper limit / lower limit exists?

Input

T: number of test cases
s: string of 3 symbols (+, -, $); + means positive number, - means negative number, $ means number given is zero.
for example, +-$ means 1st number is positive, 2nd number is negative and 3rd number is zero.

Output

Print "possible" if we can determine either upper limit or lower limit or both from given string only.
Print "trivial" if we require other conditions besides the given string of sign of numbers.

Example

Input:
1
+++

Output: possible

Note

  • lower limit of sum of two numbers say a, b is some number c such that a+b >= c;
  • upper limit of sum of two numbers say a, b is some number c such that a+b <= c;
  • Finite upper/lower limit means that the number c is countable i. e. c should not tend to infinity. (c can be positive, negative or zero).

Added by:Bhavik
Date:2014-02-04
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:own problem(for CODE MARATHON)

hide comments
2018-05-29 21:39:35
how can sum of any integer(both positive and negative) will tend to infinity or -infinity??
2017-08-26 08:50:03
The question is
Whether we can always sum three numbers with given signs and say that their sum is always not minus infinity or not plus infinity
2016-08-06 23:25:10
Yes what is this question?
2016-01-12 10:54:25 hari bhushan
more test case plz.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.