Four Season


After extreme changes in the Earth's climate, Parsa started studying temperatures in different countries. In each country, the number of days in a year may be different.

If each season in a country lasts kk days, then the whole year has 4k4k days.

The temperature pattern of each country is periodic with period 4k4k. In other words, the temperature of any day is the same as the temperature 4k4k days later.

Parsa observed the temperatures of 4k4k consecutive days and gives them to you. Note that he did not necessarily start collecting data from the first day of spring.

The seasons of each country are, in order:

  • Spring
  • Summer
  • Autumn
  • Winter

A summer is called hellish if the sum of temperatures in that summer is not smaller than the sum of temperatures of any other consecutive kk days in the year.

A winter is called freezing if the sum of temperatures in that winter is not greater than the sum of temperatures of any other consecutive kk days in the year.

From Parsa's point of view, a country is a four-season country if its summer is hellish and its winter is freezing.

For each test case, determine whether it is possible that the given list is a sequence of 4k4k consecutive days from such a country. Equivalently, determine whether it is possible to rotate the cyclic sequence so that:

  • the year is split into spring, summer, autumn, and winter, each of length kk
  • the chosen summer is hellish
  • the chosen winter is freezing

Print Yes if such a rotation exists, otherwise print No.

Input

The first line contains an integer TT, the number of test cases.

Each test case consists of two lines:

  • The first line contains an integer kk
  • The second line contains 4k4k integers a1,a2,...,a4ka_1, a_2, ..., a_{4k}

Here, aja_j is the temperature of the jj-th day in the given cyclic order.

Output

For each test case, print:

  • Yes if the sequence can represent such a country
  • No otherwise

Constraints

  • 1T5×1041 \le T \le 5 \times 10^4
  • 1k5×1041 \le k \le 5 \times 10^4
  • 109aj109-10^9 \le a_j \le 10^9
  • the sum of kk over all test cases does not exceed 5×1045 \times 10^4.

Example 1

Input 1
3
1
1 2 3 4
1
1 3 4 2
2
1 2 3 4 4 3 2 1
Output 1
No
Yes
Yes

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.