# Arup Guha
# 4/1/2020
# Solution to UCF HS Problem Kakuro - written to illustrate file input in python

def main():
    
    # Open file, get # of cases.
    myFile = open("kakuro.in", "r")
    n = int(myFile.readline())

    # Process cases.
    for loop in range(n):

        # Split splits the line into tokens in a list.
        line = myFile.readline().split()

        # Tokens are strings, so we convert to int here.
        target = int(line[0])

        # Store numbers in a list
        nums = []
        for i in range(3):
            nums.append(int(line[i+1]))

        # If both requirements are met, we are good.
        if total(nums) == target and unique(nums):
            print("Proper triplet")

        # Otherwise, we are not.
        else:
            print("Not a good triplet")

    # Safer to do this.
    myFile.close()

# Returns the sum of the values in mylist.
def total(mylist):
    add = 0
    for x in mylist:
        add += x
    return add

# Returns true if and only if all items in mylist are different.
def unique(mylist):

    # Go through all pairs of items.
    for i in range(len(mylist)):
        for j in range(i+1, len(mylist)):

            # If two values on the list are the same, the list isn't unique.
            if mylist[i] == mylist[j]:
                return False

    return True

# Go!
main()
