diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -5,7 +5,7 @@
 for _ in range(N):
     s = list(input())
     S.append(s)
-com = itertools.product(S, repeat=N)
+com = itertools.permutations(S)
 for co in com:
     ans = "Yes"
     for k in range(len(co) - 1):
