# Arup Guha
# 7/19/2013
# Solution to 2013 SI@UCF Practice Programming Contest Problem: Eighteen

def main():

    myFile = open("eighteen.in", "r")
    numCases = int(myFile.readline())

    # Go through each case.
    for i in range(numCases):

        # Get data
        tokens = myFile.readline().split()
        numStud = int(tokens[0])
        age = 0
        
        # Go through each token, updating our max age, if necesasry.
        for j in range(numStud):
            if int(tokens[j+1]) > age:
                age = int(tokens[j+1])

        # Print oldest person's age (who is presumably in college =))
        print(age)

    myFile.close()

main()
