// Arup Guha
// Solution to kakuro problem from HS 2006 Programming Contest
// Written in COP 3223 on 10/31/06

#include <stdio.h>

int main() {
    
    FILE *ifp;

    // Open the input file.    
    ifp = fopen("kakuro.in", "r");
    
    int numcases;
    int index;
    
    fscanf(ifp, "%d", &numcases);
    
    // Go through all of the cases.
    for (index=0; index<numcases; index++) {
        
        int target, d1, d2, d3, sum;
        
        // Read in all the input data for the case.
        fscanf(ifp,"%d%d%d%d", &target, &d1, &d2, &d3);
        sum = d1 + d2 + d3;
        
        // Sum of the digits match.
        if (sum == target) {
                
             // Digits are distinct.
             if (d1 != d2 && d1 != d3 && d2 != d3)
                printf("Proper triplet\n");
             
             // At least one digit is repeated.
             else
                printf("Not a good triplet\n");     
        }
        
        // The sum doesn't match.
        else {
             printf("Not a good triplet\n");
        }
    }
    
    // Close the file.
    fclose(ifp);
    return 0;
}
