what is problem with the code
n = int(input())
l = []
for i in range(n):
x = input()
l.append(x)
def anagrams(l):
d = {}
for s in l:
s1 = sorted(s)
s = "".join(s1)
if (s not in d.keys()):
d[s] = []
for s in l:
s1 = sorted(s)
s2 = "".join(s1)
d[s2].append(s)
for i in d:
d[i] = " ".join(d[i])
print(d[i])
anagrams(l)
failing some test cases