#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5+7;
ll arr[N];
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
ll mini = 1e9;
for(int i=0; i<n;i++){
cin>>arr[i];
mini=min(mini, arr[i]);
}
if(mini == arr[0]){
cout<<"YES"<<endl;
} else {
cout<<"NO"<<endl;
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbGwgbG9uZyBsb25nCmNvbnN0IGludCBOID0gMmU1Kzc7CmxsIGFycltOXTsKaW50IG1haW4oKSB7CglpbnQgdDsKCWNpbj4+dDsKCXdoaWxlKHQtLSl7CgkJaW50IG47CgkJY2luPj5uOwoJCWxsIG1pbmkgPSAxZTk7CgkJZm9yKGludCBpPTA7IGk8bjtpKyspewoJCQljaW4+PmFycltpXTsKCQkJbWluaT1taW4obWluaSwgYXJyW2ldKTsKCQl9CgkJaWYobWluaSA9PSBhcnJbMF0pewoJCQljb3V0PDwiWUVTIjw8ZW5kbDsKCQl9IGVsc2UgewoJCQljb3V0PDwiTk8iPDxlbmRsOwoJCX0KCX0KCXJldHVybiAwOwp9