#pragma comment(linker,"/STACK:102400000,102400000") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; template inline T sqr(T x) { return x * x; } typedef long long LL; typedef unsigned long long ULL; typedef long double db; typedef pair PII; typedef pair PIII; typedef pair PLL; typedef pair PLI; typedef pair PDD; #define MP make_pair #define PB push_back #define sz(x) ((int)(x).size()) #define mem(ar,val) memset(ar, val, sizeof(ar)) #define istr stringstream #define FOR(i,n) for(int i=0;i<(n);++i) #define forIt(mp,it) for(__typeof(mp.begin()) it = mp.begin();it!=mp.end();it++) const double EPS = 1e-6; const int INF = 0x3fffffff; const LL LINF = INF * 1ll * INF; const double PI = acos(-1.0); const int maxn= 1e6+10; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define lowbit(u) (u&(-u)) using namespace std; #define lowbit(a) a&-a int dir4[4][2]= {{1,0},{0,1},{-1,0},{0,-1}}; int dir8[8][2]= {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}}; int dir6[6][3]= {{0,0,1},{0,0,-1},{0,1,0},{0,-1,0},{1,0,0},{-1,0,0}};///六个方向 int movv[5][2]= {{1,0},{0,1},{0,0},{-1,0},{0,-1}}; inline LL read() { int c=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { c=c*10+ch-'0'; ch=getchar(); } return c*f; } int a[maxn],b[maxn]; int main() { int t ;t=read(); while(t--) { int n,maxx=0; n=read(); for (int i=1; i<=n; i++) a[i]=read(); sort(a+1,a+n+1); for (int i=1; i<=n; i++) maxx=max(maxx,a[i]-b[i-1]),b[i]=maxx; printf("%d\n",b[n]); } return 0; }