import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[][] p = {{0,2,10,5,3,1000},{1000,0,12,1000,1000,10},{1000,1000,0,1000,7,1000}, {2...