MAJOR - Majority

no tags 

The human tribe has just discovered some other tribe and wants to communicate with them. To make sure it is not intercepted by the terminators, they ask their chief computer engineer Rohit to design a system for the purpose. In the design that Rohit proposes, data is transmitted n times. If it is received more than half-the times, it is said to be successfully transmitted. If not, the data is said to be lost. Rohit obviously got a lot of fame and respect for his work. Nitish doesn’t like it and wants to challenge Rohit’s supremacy. He wants to check out the system and has hired you for the process.

Input

The first line of the input contains test cases t (1 <= t <= 100). It is followed by 2*t lines, 2 for each test case. The first line of input for each test case contains a number n (0 <= n <= 106), followed by n elements in the next line. Each number is from -10^3 to +10^3

Output

You are required to output ‘YES’ followed by the number transmitted, if it was transmitted successfully, and ‘NO’ otherwise.

Example

Input:
3
4
2 1 2 2
6
1 1 1 2 2 2
5
1 2 4 5 1

Output:
YES 2
NO
NO

hide comments
kobe24: 2015-05-29 03:24:59

stupid question and people are proud of doing it -_-

Aman Agarwal: 2015-05-22 08:39:19

C++ maps came to the rescue

scyth3r: 2015-05-15 20:31:12

C++ maps....
AC in one go...:D

Last edit: 2015-05-15 20:31:46
Abhay: 2015-04-05 08:52:20

Got 3 seg faults because I was submitting the unfinished code of another problem -_-

shinchan: 2015-04-04 14:31:04

getting wrong answer! do we have to leave a line after every o/p or just print on next line?

Daljeet Singh: 2015-03-25 18:49:21

only one number is transmitted successfully.

anshal dwivedi: 2015-03-07 06:05:03

AC in one go with simple use of bitwise operators..

karan: 2015-02-05 09:27:14

for those getting tle,improve the i/o methods :P

Aman: 2015-02-01 09:25:58

AC in 1st attempt... :)

Saurabh Goyal: 2015-01-28 10:24:27

All those with o(n) solution still getting TLE in java... optimization is required in IO.


Added by:Troika::Bytes
Date:2010-02-18
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: PERL6