Compare The Strings -CODEY504 Why Wrong?

You are given two Strings s1 and s2 of length N consisting of uppercase and lowercase alphabets. You have to compare both the strings in lexographical order.
While comparing the strings, the case of the letters does not matter, that is an uppercase letter is considered equivalent to the corresponding lowercase letter.
Constraints:
1 ≤ T ≤ 100
1 ≤ N ≤ 100
1 ≤ s1, s2 ≤ 100
Input:
The first line of the input file contains an integer T, the number of test cases. T test cases follow. Each test case consists of exactly 3 lines. The first line of each test case contains an integers N denoting the length of both the Strings. The second and third line contains string s1 and s2 respectively.
Output:
If the first string is less than the second one, print “S2 is greater”. If the second string is less than the first one, print “S1 is greater”. If the strings are equal, print “Both are Equal”.

Note: The letter’s case is not taken into consideration when the strings are compared.
Example Input:
3
5
cccCc
CCccc
3
aab
aac
7
abcDefg
deabcfg
Example Output:
Both are Equal
S2 is greater
Both are Equal

My Code is

cook your dish here

t=int(input())
while(t!=0):
n=int(input())
count=0
str1=input()
str2=input()
st1=sorted(str1.lower())
st2=sorted(str2.lower())
for i in range(0,n):
if st1[i]!=st2[i]:
flag=0
break
else:
flag=1

if flag!=0 :
    print("Both are Equal")
elif str1>str2:
    print("S1 is greater")
else:
    print("S2 is greater")
    
t-=1

Format your code

This problem makes zero sense. Clearly the author doesn’t know what “lexicographical order” is (and they didn’t even spell it right). I think you should give up on this problem, because it’s very likely that the test data is screwed up like the statement. Even the sample doesn’t make sense, and there’s no explanation for it either.

Yes ,
i solved the entire problem and matched the output too
it didnt make sense to me either

Still format your code

It’s sad though, that external contests are so frequently bad

yes sure thank you very much
appreciate your help