diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -1,7 +1,7 @@
 N = int(input())
 S = input()
 
-if S[0] == "B" and S[-1] == "A":
+if S[0] == "A" and S[-1] == "B":
     print("No")
 elif S == "BA":
     print("No")
