Help me in solving EVENM problem

My issue

This problem wasted 2 Hours and 30 Mins of my day.
That too just because of a bug.
It’s always giving result as ‘wrong answer’ even when I tried copy pasting the other submissions that were previously marked as correct.
This is so annoying.

My code

# cook your dish here
for _ in range(int(input())):
    n=int(input())
    a=[]
    x=1
    for i in range(n):
        m=[]
        for j in range(n):
            m.append(x)
            x+=1
        if i%2==1:
            a.append(m[::-1])
        else:a.append(m)
    for i in a:
        print(*i)

Problem Link: Even Matrix Practice Coding Problem

Thanks for reporting, this is fixed.