A binary operation \(*\) on a set \(S\) is called associative if it satisfies the associative law: \((x * y) * z = x * (y * z)\) for all \(x\), \(y\), \(z\) in \(S\).
For the binary set \(S = \{0, 1\}\) and a particular binary operator \(*\), you are given its truth table. Determine if the operation is associative.
\(a\) | \(b\) | \(a * b\) |
\(0\) | \(0\) | \(c_{0}\) |
\(0\) | \(1\) | \(c_{1}\) |
\(1\) | \(0\) | \(c_{2}\) |
\(1\) | \(1\) | \(c_{3}\) |
Input format
-
First line: A single integer \(T\) denoting the number of test cases
-
For each test case:
-
First line: Four space-separated integers \(c_{0}, c_{1}, c_{2}, c_{3}\)
-
Output format
For each test case, print 'Yes' (without quotes) in a new line if the binary operation is associative in nature. Otherwise, print 'No' (without quotes).
Constraints
\(1 \le T \le 8\)
\(c_0, c_1, c_2, c_3 \in \{ 0, 1 \}\)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial