
import std.stdio, std.typecons, std.array, std.conv, std.algorithm, std.string;

alias Tuple!(int, "from", int, "to", int, "value") Player;

bool is_correct(int i, string str) {
  if ((i % 15) == 0) {
    if (str == "FizzBuzz") return true;
    else return false;
  }
  else if ((i % 3) == 0) {
    if (str == "Fizz") return true;
    else return false;
  }
  if ((i % 5) == 0) {
    if (str == "Buzz") return true;
    else return false;
  }
  else if (isNumeric(str) && str.to!(int) == i) return true;
  else return false;
}

void main() {
  for(int count, number; readf("%d %d\n", &number, &count), (number + count) != 0;) {
    Player[int] players;

    for(int i = 2; i < number; i++) {
      players[i] = Player(i - 1, i + 1, i);
    }
    players[1] = Player(number, 2, 1);
    players[number] = Player(number - 1, 1, number);

    int id = 1;
    for(int i = 1; i <= count; i++) {
      string s = readln.chomp;
      if (players.length == 1) continue;
      if (is_correct(i, s)) {
        id = players[id].to;
      }
      else {
        int to = players[id].to;
        int from = players[id].from;
        players.remove(id);
        players[from].to = to;
        players[to].from = from;
        id = to;
      }
    }
    players.keys.sort.map!(to!(string)).array.join(" ").writeln;
  }
}