A 面试

纯模拟

for _ in range(int(input())):
    s=input()
    if s.count("D")>=1 or s.count("C")>=2:
        print("failed")
    elif s.count("A")>=3 and "D" not in s:
        print("sp offer")
    else:
        print("offer")