Help me in solving AVGPERM problem

My issue

error

My code

def generate_permutation(N):
    if N == 3:
        return [3, 2, 1]
    elif N == 4:
        return [3, 2, 1, 4]
    else:
        # For N > 4, just return the descending order
        return list(range(N, 0, -1))

# Read input
T = int(input())
test_cases = [int(input()) for _ in range(T)]

# Generate results
results = []
for N in test_cases:
    permutation = generate_permutation(N)
    results.append(" ".join(map(str, permutation)))

# Print results
for result in results:
    print(result)

Learning course: Additional practice problems
Problem Link: https://www.codechef.com/learn/course/kl-daa-practice/KLDAAPR01/problems/AVGPERM