Given an array $A$ of length $N$.
We have to find the $maximum$ sum of elements of the subarray between $two$ nearest occurrences of $same$ elements (excluding both).
If both the elements are $even$ then the total number of $even$ elements in that subarray should be $even$ then and then only we consider that subarray and if both the elements are $odd$ then the total number of $odd$ element in that subarray should be $odd$ then and then only we consider that subarray.
If the condition never matches print $0$.

-----Input:-----
- First line contains $T$, number of test cases. Then the test cases follow.
- Each testcase consists of two lines: 
The first line has $N$ : number of elements in the array and second-line has $N$ space separated integers: elements of the array.

-----Output:-----
- For each test case, output in a single line $maximum$ sum.

-----Constraints-----
- $1 \leq T \leq 10$
- $3 \leq N \leq 2*10^5$
- $1 \leq A[i] \leq 10^8$
$NOTE $: Use of Fast Input Output is recommended.

-----Sample Input:-----
1
10
1 2 3 2 1 5 1 2 8 2

-----Sample Output:-----
7

-----EXPLANATION:-----
The maximum sum is 7, between 1 at  1st position and 1 at 5th position i.e sum of 2,3,2

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'from collections import *\r\n\r\nfor _ in range(int(input())):\r\n    n = int(input())\r\n    l = [*map(int,input().split())]\r\n    ans = 0\r\n    ind = defaultdict(list)\r\n    even = []\r\n    odd = []\r\n    for i in range(n):\r\n        ind[l[i]].append(i)\r\n        if l[i] % 2 == 0:\r\n            if not even:\r\n                even.append(1)\r\n            else:\r\n                even.append(even[-1] + 1)\r\n        else:\r\n            if not even:\r\n                even.append(0)\r\n            else:\r\n                even.append(even[-1])\r\n        if l[i] % 2 == 1:\r\n            if not odd:\r\n                odd.append(1)\r\n            else:\r\n                odd.append(odd[-1] + 1)\r\n        else:\r\n            if not odd:\r\n                odd.append(0)\r\n            else:\r\n                odd.append(odd[-1])\r\n    pre_sum = [l[0]]\r\n    for i in range(1,n):\r\n        pre_sum.append(pre_sum[-1] + l[i])\r\n    for i in ind:\r\n        x = len(ind[i])\r\n        if x > 1:\r\n            for j in range(x - 1):\r\n                if i % 2 == 0:\r\n                    if ind[i][j] > 0 and even[ind[i][j] + 1] != even[ind[i][j]] and (even[ind[i][j + 1] - 1] - even[ind[i][j] + 1] + 1) % 2 == 0:\r\n                        ans = max(ans,pre_sum[ind[i][j + 1] - 1] - pre_sum[ind[i][j]])\r\n                    elif ind[i][j] == 0 and (even[ind[i][j] + 1] != even[ind[i][j]]) and (even[ind[i][j + 1] - 1] - even[ind[i][j] + 1] + 1) % 2 == 0:\r\n                        ans = max(ans,pre_sum[ind[i][j + 1] - 1] - pre_sum[ind[i][j]])\r\n                    elif ind[i][j] == 0 and (even[ind[i][j] + 1] == even[ind[i][j]]) and (even[ind[i][j + 1] - 1] - even[ind[i][j] + 1]) % 2 == 0:\r\n                        ans = max(ans,pre_sum[ind[i][j + 1] - 1] - pre_sum[ind[i][j]])\r\n                    elif ind[i][j] > 0 and (even[ind[i][j] + 1] == even[ind[i][j]]) and (even[ind[i][j + 1] - 1] - even[ind[i][j] + 1]) % 2 == 0:\r\n                        ans = max(ans,pre_sum[ind[i][j + 1] - 1] - pre_sum[ind[i][j]])\r\n\r\n                if i % 2 == 1:\r\n                    if ind[i][j] > 0 and odd[ind[i][j] + 1] != odd[ind[i][j]] and (odd[ind[i][j + 1] - 1] - odd[ind[i][j] + 1] + 1) % 2 == 1:\r\n                        ans = max(ans,pre_sum[ind[i][j + 1] - 1] - pre_sum[ind[i][j]])\r\n                    elif ind[i][j] == 0 and (odd[ind[i][j] + 1] == odd[ind[i][j]]) and (odd[ind[i][j + 1] - 1] - odd[ind[i][j] + 1]) % 2 == 1:\r\n                        ans = max(ans,pre_sum[ind[i][j + 1] - 1] - pre_sum[ind[i][j]])\r\n                    elif ind[i][j] == 0 and (odd[ind[i][j] + 1] != odd[ind[i][j]]) and (odd[ind[i][j + 1] - 1] - odd[ind[i][j] + 1] + 1) % 2 == 1:\r\n                        ans = max(ans,pre_sum[ind[i][j + 1] - 1] - pre_sum[ind[i][j]])\r\n                    elif ind[i][j] > 0 and (odd[ind[i][j] + 1] == odd[ind[i][j]]) and (odd[ind[i][j + 1] - 1] - odd[ind[i][j] + 1]) % 2 == 1:\r\n                        ans = max(ans,pre_sum[ind[i][j + 1] - 1] - pre_sum[ind[i][j]])\r\n    print(ans)'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 17257