Given an array A of length N. Determine if there exists an element in the array such that the sum of the elements on its left is equal to the sum of

the elements on its right. If there are no elements to the left/right, then the sum is considered to be zero.

Formally, find an i, such that, A1+A2...Ai-1 =Ai+1+Ai+2...AN.

**Input:**

** **The first line contains T, the number of test cases. For each test case, the first line contains N, the number of elements in the array A. The

second line for each test case contains N space-separated integers, denoting the array A.

**Output:**

For each test case print YES if there exists an element in the array, such that the sum of the elements on its left is equal to the sum of the

elements on its right; otherwise print NO in a separate line.

**Constraints:**

1≤ T ≤ 30

1≤ N ≤100000

1≤ Ai ≤ 2×10000

1≤ i ≤N

**Example:**

Input

1

4

1 2 3 3

Output:

YES

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.

mantan_g | 267 |

tushki | 198 |

aksht7 | 182 |

ayush1101 | 128 |

namansharmacse17 | 110 |

ARUN_PUNDIR | 730 |

manishgupta8497 | 627 |

AMAN__JAIN | 625 |

Abhimanyu_kumar | 562 |

AJ786 | 541 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4584 |

Login to report an issue on this page.