Help me in solving RATINGINPRAC problem

My issue

its showing runtime error

My code

#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    int a[10],n,i;
	    cin>>n;
	    for(int i=0;i<n;i++)
	    cin>>a[i];
	    if(a[i]<a[i-1]){
	        cout<<"Yes"<<endl;
	    }
	    else{
	    cout<<"No"<<endl;
	    }
	    
	}
	return 0;
}

Learning course: Arrays using C++
Problem Link: CodeChef: Practical coding for everyone

@hema_chows06
I have corrected some logical mistakes in your code . Hope u will get it .

#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    int n,i;
	    cin>>n;
	    int a[n];
	    int ch=0;
	    for(int i=0;i<n;i++)
	    cin>>a[i];
	    for(int i=1;i<n;i++)
	    {
	    if(a[i]<a[i-1]){
	        ch=1;
	    }
	    }
	    if(ch)
	    cout<<"NO";
	    else
	    cout<<"YES";
	    cout<<endl;
	}
	return 0;
}