// This file is a "Hello, world!" in Java language by OpenJDK for wandbox. import java.util.*; import java.io.*; class Main { public static void main(String[] args) { new Main().run(); } boolean check(long[] a){ if(a[0]==a[1]||a[1]==a[2]||a[2]==a[0]||a[0]<=0||a[1]<=0||a[2]<=0)return false; return a[1]==Math.min(a[0],Math.min(a[1],a[2])) || a[1]==Math.max(a[0],Math.max(a[1],a[2])); } long solve(long[] a,long[] c){ // if(a[0]>a[2]){ // a[0]^=a[2];a[2]^=a[0];a[0]^=a[2]; // } if(check(a))return 0; ArrayList list=new ArrayList<>(); list.add(0L); for(int i=0;i<3;++i){ for(int d=-2;d<=2;++d){ if(a[i]+d>0) list.add(a[i]+d); } } for(int i=0;i0) list.add(a[i]-a[j]+d); } } } long ret=Long.MAX_VALUE/3; for(int i=0;i1e10?-1:ret; } void run(){ Scanner sc=new Scanner(System.in); PrintWriter pw=new PrintWriter(System.out); int T=sc.nextInt(); for(int t=0;t