#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
int arr[n],hell[n],count;
for (int i=0;i<n;++i)
{
scanf("%d",&arr);
}
for(int i=0;i<n;++i)
{
if (i=n-1)
{
break;
}
else if (arr>arr[i+1])
{
count=arr;
}
else if(arr<arr[i+1])
{
count=arr[i+1];
}
}
printf("%d",&count);
}
}
/*I wanted to find the largest element in an int array, which has 'n' elements.
first user will input no. of testcases.
then input the no. of element
then input the elements
program should then print the largest integer element(Only integers will be entered by user)
on execution I am getting some garbage value
for eg. test cases=1,no. of elements=2,elemts=77,101,then program prints garbage like -1485932559*/
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
int arr[n],hell[n],count;
for (int i=0;i<n;++i)
{
scanf("%d",&arr);
}
for(int i=0;i<n;++i)
{
if (i=n-1)
{
break;
}
else if (arr>arr[i+1])
{
count=arr;
}
else if(arr<arr[i+1])
{
count=arr[i+1];
}
}
printf("%d",&count);
}
}
/*I wanted to find the largest element in an int array, which has 'n' elements.
first user will input no. of testcases.
then input the no. of element
then input the elements
program should then print the largest integer element(Only integers will be entered by user)
on execution I am getting some garbage value
for eg. test cases=1,no. of elements=2,elemts=77,101,then program prints garbage like -1485932559*/