![](https://i-blog.csdnimg.cn/blog_migrate/f0d705095090dd0fe0685b8014c163bc.png)
#include<stdio.h>
void bubble(int arr[][11], int n,int line) {
for(int i=0;i<n-1;i++)
for (int j = 0; j < n - 1 - i; j++) {
int tmp;
if (arr[line][j] > arr[line][j + 1]) {
tmp = arr[line][j + 1];
arr[line][j + 1] = arr[line][j];
arr[line][j] = tmp;
}
}
}
int main() {
int num;
int flag = 0;
scanf("%d", &num);
int arr[10000][11];
int n[10000];
for (int i = 0; i < num; i++) {
scanf("%d", &n[i]);
for (int j = 0; j < n[i]; j++) {
scanf("%d", &arr[i][j]);
}
}
for (int i = 0; i < num; i++)
{
bubble(arr, n[i], i);
for (int j = 0; j < n[i]; j++)
{
flag = 0;
if (arr[i][j] > arr[i][0])
{
printf("%d\n", arr[i][j]);
flag = 1;
break;
}
}
if (flag == 0)
printf("NO\n");
}
return 0;
}