diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -1,3 +1,4 @@
 n = int(input())
 s = input()
-print("No" if s[0] == "A" and s[-1] == "B" else "Yes")
+
+print("No" if (s[0] == "A" and s[-1] == "B") or s == "BA" else "Yes")
