import std.stdio, std.string, std.conv, std.algorithm;
void main()
{
  auto t = readln.chomp.to!int;
  while(t--){
    int u,d;
    auto n = readln.chomp.to!int;
    auto a = readln.split.map!(to!int);
    for(int i;i<n-1;++i){
      int b = a[i+1]-a[i];
      if(b>=0)
	b>u ? u=b:u=u;
      else
	-b>d ? d=-b:d=d;
    }
    writeln(u," ",d);
  }
}