matches:: Int -> Int -> [String]
matches a b = match 0 0
  where
    isDecided::Int -> Int -> Bool
    isDecided 6 4 = True
    isDecided 4 6 = True
    isDecided 5 5 = True
    isDecided n m
      |(n <= 3) && (m >= 5) = True
      |(m <= 3) && (n >= 5) = True
      |otherwise = False

    match :: Int -> Int -> [String]
    match n m
      |(n == a) && (m == b) = [""]
      |isDecided n m = []
      |(n > a) || (m > b) = []
      |otherwise = (map ('A':) (match (n + 1) m)) ++ (map ('B':) (match n (m + 1)))

main = do
  j:y:_ <- fmap (map read . words) getLine :: IO [Int]
  mapM_ putStrLn $ matches j y
