import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class money { /** * @param args * @throws FileNotFoundException */ public static void main(String[] args) throws FileNotFoundException { int[] suspects = new int[50]; Scanner input = new Scanner(new File("money.in")); int numDataSets = input.nextInt(); int numSuspects; int numTransactions; for(int i = 0; i < numDataSets; i++) { for(int z = 0; z < 50; z++) suspects[z] = 0; numSuspects = input.nextInt(); numTransactions = input.nextInt(); int x, y; for(int j = 0; j < numTransactions; j++) { suspects[input.nextInt()] += input.nextInt(); } int highestTransaction = 0; int tempSuspect = 0; for(int k = 1; k < numSuspects + 1; k++) { if(suspects[k] > highestTransaction) { tempSuspect = k; highestTransaction = suspects[k]; } } boolean suspectFound = true; for(int l = 1; l < numSuspects + 1; l++) { if(tempSuspect != l){ if(suspects[tempSuspect] <= 2 * suspects[l]) suspectFound = false; } } System.out.println("Data Set " + (i + 1) + ":"); if(suspectFound) System.out.println(tempSuspect); else System.out.println("No suspect."); if(i != numDataSets - 1) System.out.println(); } } }