Given two force vectors, find out whether they are parallel, perpendicular or neither. Let the first vector be A = a1 i +a2 j + a3 k and the second vector be B = b1 i + b2 j + b3 k.

A.B = a1*b1 + a2*b2 + a3*b3

A x B = (a2*b3 - a3*b2) i - (a1*b3 - b1*a3) j + (a1*b2 - a2*b1) k

|A|^2 = a1^2 + a2^2 + a3^2

If A.B = 0, then A and B are perpendicular.

If |A X B|^2 = 0, then A and B are parallel.

**Input:**

The first line of input takes the number of test cases, **T**. Then T test cases follow. For each test case there will be two lines. The first line contains **3** space separated integers representing the components of the first force vector in x, y and z directions. The second line also contains **3** space separated integers representing the components of the second force vector in x, y and z directions.

**Output:**

Print 1 if the 2 vectors are parallel, 2 in case they are perpendicular, 0 otherwise.

**Constraints:**

1 <= T <= 100

-100 <= Component <= 100

**Example:
Input:**

3

3 2 1

6 4 2

4 6 1

1 -1 2

10 9 5

2 6 1

**Output:**

1

2

0

Author: akundusaltlake

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Akkki111 | 38 |

SaltBaeSama | 34 |

ambercyrus | 33 |

LegendFire | 32 |

chocozz | 32 |

KshatriyaYash | 1932 |

nikhil_sojan | 1374 |

lonecoder | 1219 |

mazumderrohit8 | 1095 |

SumitSingh27 | 1090 |

blackshadows | 5327 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4566 |

Quandray | 4444 |

Login to report an issue on this page.