import java.util.Scanner;
public class Solution {
public static void main(String[] args){
Scanner kb = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
int T = kb.nextInt();
for(int i=1; i<=T; i++) {
sb.append("#").append(i).append(" ");
int N = kb.nextInt();
int[] heights = new int[N];
for(int j=0; j<N; j++) {
heights[j] = kb.nextInt();
}
int max =0;
int min =0;
for(int k=1; k<N; k++) {
int diff = heights[k]- heights[k-1];
if(diff>0) {
max = Math.max(max, diff);
}else if(diff<0) {
min = Math.max(min, -diff);
}
}
sb.append(max).append(" ").append(min).append('\n');
}
System.out.print(sb.toString());
}
}