import java.util.*;public class Main {private static int sum = 0;public static void main(String[] args) {Scanner in = new Scanner(System.in);while(in.hasNextInt()){int n = in.nextInt();int a[][] = new int[n][2];for(int i = 0; i < n; i++){a[i][0] = in.nextInt();a[i][1] = in.nextInt();}String s = i...