# Beginning of solution to https://open.kattis.com/problems/permutedarithmeticsequence

# Notes
# dir(L)
# help(L.pop)

# Are lists passed by reference or pass by value?  Pass by reference.
# But strings and such are pass by value.
def integerize(L):
    for i in range(0,len(L)):
        L[i] = int(L[i])

def isArithmetic(L):
    return True

n = int(input())

for i in range(0, n):
    line = input()
    L = line.split(' ')
    L.pop(0)
    integerize(L)
    if isArithmetic(L):
        print("arithmetic")
    else:
        # sort L and check if that is arithmetic
        L.sort()
        # then check if it's arithmetic now