#C10562. Find Zero-Sum Subarray

    ID: 39781 Type: Default 1000ms 256MiB

Find Zero-Sum Subarray

Find Zero-Sum Subarray

You are given an array of integers. Your task is to determine if there exists a non-empty contiguous subarray such that the sum of its elements is zero.

If such a subarray is found, output its 1-indexed starting and ending positions. Otherwise, print NO.

Formally, given an array \(a_1, a_2, \dots, a_N\), find indices \(l\) and \(r\) with \(1 \le l \le r \le N\) such that \[ \sum_{i=l}^{r} a_i = 0 \] If there are multiple answers, output the first such subarray you find.

The input consists of multiple test cases; be sure to process each test case independently.

inputFormat

The first line contains an integer T representing the number of test cases. For each test case, the first line contains an integer N (the size of the array). The second line contains N space-separated integers representing the elements of the array.

outputFormat

For each test case, output one line. If a zero-sum subarray exists, print two integers separated by a space representing the 1-indexed starting and ending positions of this subarray. If no such subarray exists, print NO.

## sample
1
5
1 2 -3 4 5
1 3

</p>