main(){
	int n,u,d,h,p;
	scanf("%*d");
	for(;~scanf("%d",&n);){
		u=d=0;
		scanf("%d",&p);
		for(;--n;){
			scanf("%d",&h);
			if(h-p>u)
				u=h-p;
			if(h-p<d)
				d=h-p;
			p=h;
		}
		printf("%d %d\n",u,-d);
	}
}