## main

while true
  m, n = gets.strip.split(' ').map{|s| s.to_i}
  break if m == 0 && n == 0

  players = (1..m).to_a
  cur_p = 0

  for num in (1..n)
    s = gets.strip
    next if players.length == 1

    div3 = (num % 3 == 0)
    div5 = (num % 5 == 0)
    expected =
      (div3 && div5) ? 'FizzBuzz' :
      div3 ? 'Fizz' :
      div5 ? 'Buzz' :
      num.to_s
    #p [pn, s, expected]

    if s != expected
      players.delete_at(cur_p)
      cur_p %= players.length
    else
      cur_p = (cur_p + 1) % players.length
    end
  end

  puts players.join(' ')
end