shui题
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
const int N=1e5+5;
int a[N];
int n,m;
void solve(){
int i,t,ans=-1e9;
cin>>n;
for(i=1;i<=n;i++) cin>>a[i];
t=a[1];
for(i=2;i<=n;i++){
ans=max(ans,t-a[i]);
t=max(t,a[i]);
}
cout<<ans<<endl;
}
int main(){
int cas;
cin>>cas;
while(cas--) solve();
}