#include using namespace std; typedef long long ll; int main(){ ll t; cin>>t; assert(t>=1 && t<=30); while(t--){ ll n,r,max=999999999,min=0,a[1000000]; cin>>n>>r; assert(n>=1 && n<=1000000); assert(r>=1 && r<=1000000000); for(ll i=0;i>a[i]; assert(a[i]>=1 && a[i]<=1000000000); } //All inputs taken ll prev=a[0],flag=0; //prev holds the value of the rating of the previous person for(ll i=1;imin){ //if rating of the next person is lesser than previous, and more than the minimum possible rating (to check if it adheres to the constraints), the maximum rating possible becomes prev max=prev; prev=a[i]; }else if(a[i]>prev && a[i]