import Control.Monad

main :: IO ()
main = do
  mn <- getLine
  if mn == "0 0"
    then return ()
    else do
      let [m,n] = map read . words $ mn
      ls <- replicateM n getLine
      putStrLn (solve m ls)
      main

solve :: Int -> [String] -> String
solve m ls = format (update (cycle [1..m]) [1..m] 1 ls)
  where
    format :: [Int] -> String
    format [] = []
    format [x] = show x
    format (x:xs) = (show x) ++ " " ++ (format xs)
    update :: [Int] -> [Int] -> Int -> [String] -> [Int]
    --update order surviveL count responseL
    update _ [x] _ _ = [x]
    update _ surviveL _ [] = surviveL
    update (x:xs) surviveL count (response:responseL)
      | elem x surviveL = update xs (judge count response x surviveL) (count+1) responseL
      | otherwise = update xs surviveL count (response:responseL)
      where
        judge :: Int -> String -> Int -> [Int] -> [Int]
        judge c r x s
          | c `mod` 15 == 0 && r == "FizzBuzz" = s
          | c `mod` 5 == 0 && r == "Buzz" = s
          | c `mod` 3 == 0 && r == "Fizz" = s
          | c `mod` 3 /= 0 && c `mod` 5 /= 0 && show c == r = s
          | otherwise = rem x s
          where
            rem :: Int -> [Int] -> [Int]
            rem _ [] = []
            rem x (y:ys)
              | x == y = ys
              | otherwise = y:(rem x ys)