Help Ruchi

4

1 votes
Medium
Problem

Ruchi is doing her undergrad in Maths from a reputed college in New Delhi. Recently her professor gave her a problem which is baffling her for a long time. So she asks your help.

Problem is:

Given order of n x n matrix is it possible to find two matrices such that when there corresponding elements are combined in the form of (x,y), the resulting matrix yield all n x n pairs i.e all pairs of {1,2,3,.....,n} X {1,2,3,......,n}.

For example:

n=3 Two possible matrices are:

A

1 2 3
3 1 2
2 3 1

B
1 2 3
2 3 1
3 1 2

Now, when we combine the corresponding elements, we get the following matrix.

C (1,1) (2,2) (3,3) (3,2) (1,3) (2,1) (2,3) (3,1) (1,2)

Matrix C contains all the element of set {1,2,3} X {1,2,3}. So, ans for this order will be "Yes".

[Note:] :Each value from 1 to n appear in each row and column once.

[Input]
First line of the input contain integer t denoting no.of test cases. Next t line contains a single integer n denoting the order of the matrix.

[Output]
For each test case output "Yes" if it is possible else print "No".

[Constraints]
1<=t<=1000000 2<=n<=1000000

This problem is dedicated to my friend Ruchi on her birthday (19th June). She is doing her undergraduate in Mathematics. :)

Note:
Use printf / scanf instead of cin and cout .

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?