### main

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

  players = m.times.map{true}

  num = 1
  pn = 0

  n.times.each do
    s = gets.strip
    next if n == 1

    div3 = (num % 3 == 0)
    div5 = (num % 5 == 0)
    expected =
      (div3 && div5) ? 'FizzBuzz' :
      div3 ? 'Fizz' :
      div5 ? 'Buzz' :
      num.to_s

    if s != expected
      players[pn] = false
      n -= 1
    end

    pn = (pn + 1) % m
    while ! players[pn]
      pn = (pn + 1) % m
    end

    num += 1
  end

  rems = (0...m).select{|i| players[i]}.map{|i| i + 1}
  puts rems.join(' ')
end