var t = +readline();
 
while(t--) {
    const array = readline().split(' ').map(Number);
    
  	const dp = [0];
    
    array.forEach((element, index) {
		if(!index) continue;
  		
  		for(let i = 0; i < 2; i++) {
			dp[i] = Max((dp[i] || 0), Math.abs(array[i] - array[index]);
		}
	});
        
    print(dp[dp.length - 1]);
}