Logical Functions: AND and OR

No attempts yetTime limit2sMemory limit256 MB

Problem

A neuron node takes two inputs, X1X_1 and X2X_2. Each input is 0 or 1. Every input carries its own weight: W1W_1 belongs to X1X_1 and W2W_2 belongs to X2X_2. The node also has a bias BB, which moves the point where the node turns on.

The node first computes the weighted sum

A=X1W1+X2W2+BA = X_1 W_1 + X_2 W_2 + B

and then applies a step activation function. The output is 1 when A0A \ge 0, and 0 otherwise.

Figure 1. Neuron node

A machine learning class asked its students to pick weights and a bias so that one neuron node computes a logical AND, or a logical OR. You are the teaching assistant, so you have to check the submissions. A submission is correct when the output of the node equals the value of the requested logical function for all four combinations of X1X_1 and X2X_2.

Input

The first line contains the number of test cases TT (1<T<2001 < T < 200).

Each of the next TT lines describes one submission: a word, then three real numbers W1W_1, W2W_2 and BB, separated by whitespace. The word is either AND or OR and names the logical function that submission has to compute. W1W_1 and W2W_2 are the weights (2.5W1,W22.5-2.5 \le W_1, W_2 \le 2.5) and BB is the bias (5B5-5 \le B \le 5). The numbers may contain a decimal point, and two tokens may be separated by more than one space.

Output

Print one line for each test case, in input order. Print true when the node computes the requested logical function for all four combinations of X1X_1 and X2X_2, and false otherwise. Print both words in lowercase and without quotes.