Title: FizzBuzz

There is a game using numbers called "Fizz Buzz". In this game, multiple players count up numbers one by one from 1, and each player says only the next number spoken by the previous player. If the number is divisible by 3, the player says "Fizz", if it's divisible by 5, the player says "Buzz", and if it's divisible by both, the player says "FizzBuzz" instead of the number. For example, the first 16 statements are as follows:

1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FizzBuzz, 16, ...

Taro and his friends decided to play "Fizz Buzz" with the following rule: "The person who makes a mistake is eliminated. The next person starts from the number after the mistaken one. For example, if 1, 2, 3 are spoken, the next number should be 4 since 3 was a mistake."

You are tasked to create a program that outputs the remaining player at the end of the specified number of statements, so that Taro and his friends can enjoy the game. The program should take the number of players, the number of statements made during the game, and the input statements, and output the numbers of the remaining players in ascending order. The players are numbered from 1, and the statements are made in order, starting from the first player. If it's the turn of a player who has already been eliminated, the next player speaks. The program should stop considering further statements once only one player remains.

Input:
Multiple datasets are given as input, and the end of the input is indicated by two consecutive zeros. Each dataset is in the following format:

m n
s1
s2
...
sn

The first line contains the number of players m (2 ≤ m ≤ 1000) and the number of statements n (1 ≤ n ≤ 10000). The following n lines contain the i-th statement si. si is an integer, "Fizz", "Buzz", or "FizzBuzz" (up to 8 characters).

The number of datasets does not exceed 50.

Output:
For each input dataset, output the numbers of the remaining players in ascending order at the specified number of statements.

Sample Input:
5 7
1
2
Fizz
4
Buzz
6
7
3 5
1
2
3
4
5
0 0

Output for the Sample Input:
2 3 4 5
1

# Buggy version:
def fizz_buzz():
    c = 1
    while True:
        res = ''
        if c % 3 == 0:
            res = res + 'Fizz'
        if c % 5 == 0:
            res = res + 'Buzz'
        if res == '':
            yield str(c)
        else:
            yield res
        c += 1

while True:
    m,n = map(int,input().split())
    if m == 0: break

    player = list(range(m))

    p = 0
    fb = fizz_buzz()
    for i in range(n):
        inp = input()
        if len(player) > 1:
            if  inp != next(fb):
                del player[p] 
            else:
                p = (p+1) % len(player)

    print(result)

# Fixed version:
def fizz_buzz():
    c = 1
    while True:
        res = ''
        if c % 3 == 0:
            res = res + 'Fizz'
        if c % 5 == 0:
            res = res + 'Buzz'
        if res == '':
            yield str(c)
        else:
            yield res
        c += 1

while True:
    m,n = map(int,input().split())
    if m == 0: break

    player = list(range(m))

    p = 0
    fb = fizz_buzz()
    for i in range(n):
        inp = input()
        if len(player) > 1:
            if  inp != next(fb):
                del player[p] 
                p = p % len(player)
            else:
                p = (p+1) % len(player)

    result = str(player[0]+1)
    if len(player) > 1:
        for pi in player[1:]:
            result += ' ' + str(pi+1)

    print(result)

# Buggy version:
def fizzbuzz(i):
    if i % 15 == 0:
        return 'FizzBuzz'
    elif i % 5 == 0:
        return 'Buzz'
    elif i % 3 == 0:
        return 'Fizz'
    else:
        return str(i)

import sys
f = sys.stdin

while True:
    m, n = map(int, f.readline().split())
    if m == n == 0:
        break
    member = list(range(1, m + 1))
    s = [f.readline().strip() for _ in range(n)]
    offset = 0
    for i in range(n):
        print(s[i]==fizzbuzz(i+1),offset,m)
        if s[i] != fizzbuzz(i + 1):
            pos = (i - offset) % m
            member.remove(member[pos])
            offset = i - pos + 1
            m -= 1
            if len(member) == 1:
                break
        
    print(*member)

# Fixed version:
def fizzbuzz(i):
    if i % 15 == 0:
        return 'FizzBuzz'
    elif i % 5 == 0:
        return 'Buzz'
    elif i % 3 == 0:
        return 'Fizz'
    else:
        return str(i)

import sys
f = sys.stdin


while True:
    m, n = map(int, f.readline().split())
    if m == n == 0:
        break
    member = list(range(1, m + 1))
    s = [f.readline().strip() for _ in range(n)]

    pos = 0
    for i in range(n):
        if s[i] != fizzbuzz(i + 1):
            del member[pos]
            m = len(member)
            if m == 1:
                break
        else:
            pos += 1
        pos %= m
        
    print(*member)

# Buggy version:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0221

"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline


def fb_gen(count=1):
    while True:
        if count % 15 == 0:
            ans = 'FizzBuzz'
        elif count % 5 == 0:
            ans = 'Buzz'
        elif count % 3 == 0:
            ans = 'Fizz'
        else:
            ans = str(count)
        yield ans
        count += 1


def main(args):
    while True:
        m, n = map(int, input().split())
        if m == 0 and n == 0:
            break
        players = deque(range(1, m+1))
        fb = fb_gen()
        for _ in range(n):
            p = input().strip()
            # print('player {}: {}'.format(players[0], p))
            if p != fb.__next__():
                # drop = players.popleft()
                pass
                # print('player {} dropped'.format(drop))
                if len(players) == 1:
                    break
            else:
                players.rotate(-1)

        result = list(players)
        result.sort()
        print(*result)


if __name__ == '__main__':
    main(sys.argv[1:])

# Fixed version:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0221

"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline


def fb_gen(count=1):
    while True:
        if count % 15 == 0:
            ans = 'FizzBuzz'
        elif count % 5 == 0:
            ans = 'Buzz'
        elif count % 3 == 0:
            ans = 'Fizz'
        else:
            ans = str(count)
        yield ans
        count += 1


def main(args):
    while True:
        m, n = map(int, input().split())
        if m == 0 and n == 0:
            break
        players = deque(range(1, m+1))
        fb = fb_gen()
        ok_count = 0
        for _ in range(n):
            p = input().strip()
            if p != fb.__next__():
                if len(players) > 1:
                    players.rotate(ok_count)
                    players.popleft()
                    ok_count = 0
            else:
                ok_count -= 1

        result = list(players)
        result.sort()
        print(*result)


if __name__ == '__main__':
    main(sys.argv[1:])