List<Integer> triple(int[][]A) {
		for (int i=0;i<A.length;++i) Arrays.sort(A[i]);
		int n=A.length;
		int[] index=new int[n],rel=new int[n+1];rel[n]=Integer.MAX_VALUE;
		while (true) {
			int sum=abSum(A, index);
			if (rel[n]>sum) {
				rel=Arrays.copyOf(index, n+1);
				rel[n]=sum;
			}
			int i=-1,val=Integer.MAX_VALUE;
			for (int j=0;j<n;++j) {
				if (index[j]==A[j].length-1) continue;
				if (A[j][index[j]]<val) {
					i=j;
					val=A[j][index[j]];
				}
			}
			if (i==-1) break;
			++index[i];
		}
		List<Integer> list=new ArrayList<>();
		for (int i=0;i<n;++i) list.add(A[i][rel[i]]);
		return list;
	}