TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Have you ever thought about comparing the weight of fruits? That's what you should do in this problem! Given a series of fruit weight comparisons, you should anticipate the result of another comparison. In this problem, all fruits of the same kind are identical and have the same weights. Each fruit weight comparison is something like ``<!-- MATH
$a \ X \le b \ Y$
-->
a X<=b Y
" in which a
and b
are positive integers, and X

and Y
are fruit names. Such a comparison means that the weight of a
fruits of type X
is less than or equal to the weight of b
fruits of type Y

.

Input Format

The input contains multiple test cases. Each test case starts with a line containing n
, which is the number of given comparisons. Each of the next n
lines gives a comparison in the form of <!-- MATH
$a \ X \ b \ Y$
-->
<span class="MATH"><i>a</i> <i>X</i> <i>b</i> <i>Y</i></span>
<tex2html_verbatim_mark>" meaning that
<!-- MATH
$a \ X \le b \ Y$
-->
a X<=b Y

". The last line of each test case contains the comparison query in the same form of <!-- MATH
$a \ X \ b \ Y$
-->
<span class="MATH"><i>a</i> <i>X</i> <i>b</i> <i>Y</i></span>
<tex2html_verbatim_mark>" inquiring the comparison of
a X
" and ``b Y
".

A case of n = 0
shows the end of input and should not be processed. All integers in the input (except the last n
which is 0) are positive and are not greater than 100. Fruit names are case-sensitive strings of (lowercase and uppercase) letters with length no more than 50.

Output Format

For each test case, write one line with your result for that test case. Your result can be one of the followings (assume the comparison query was ``<!-- MATH
$a \ X \ b \ Y$
-->
a X b Y
"):


  • <tt><=</tt>": meaning you are sure that<!-- MATH
    $a \ X \le b \ Y$
    -->

    a X<=b Y
    ".


  • <tt>>=</tt>": meaning you are sure that<!-- MATH
    $a \ X \ge b \ Y$
    -->
    a X>=b Y
    ".


  • <tt>==</tt>": meaning you are sure that<!-- MATH
    $a \ X = b \ Y$
    -->
    a X = b Y
    " (i.e. you have reached both of the above results).

  • <tt>UNAVAILABLE</tt>": meaning that you can say nothing for sure in comparinga X

    " and <span class="MATH"><i>b</i> <i>Y</i></span>
    <tex2html_verbatim_mark>" (i.e. you have reached none of the above results).
    </tex2html_verbatim_mark></tex2html_verbatim_mark></li>
    <li>
    INCONSISTENT": meaning that there is an inconsistency in the given comparisons (i.e. you are sure that all the given comparisons for
    that test case cannot hold at the same time).

Sample Input 1

2
2 Orange 3 Apple
1 Apple 1 Peach
2 Orange 3 Peach
1
2 Orange 3 Apple
2 Orange 2 Apple
2
3 a 2 A
2 A 3 a
5 A 5 a
2
3 B 2 A
2 A 3 B
2 A 3 B
3
2 b 2 A
2 A 2 C
3 C 2 b
1 A 1 b
0

Sample Output 1

<=
UNAVAILABLE
>=
==
INCONSISTENT

Hints

Problem Source

Migrated from old NTUJ.

ICPC Tehran, 2008

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200