Help me in solving LB02A problem

My issue

My code

# Step 1: Read and understand the problem statement and sample test cases

# Click on 'Next' once you are ready to proceed.
tc=int(input())
for t in range(tc):
    x,y,z=map(int,input().split())

Learning course: Python for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone

Please click next, the logic is explained ahead.