#include <bits/stdc++.h>
using namespace::std;
int main(int argc, const char ** argv)
{
int n, m;
static vector<int> nums;
while (cin >> n >> m)
{
bool isFun = true;
if (m == 0 || m == 1)
isFun = false;
while (isFun)
{
nums.push_back(n);
if (n % m)
isFun = false;
else
n /= m;
if (n == 1)
break;
}
if (isFun) {
for (auto &&i : nums)
cout << i << ' ';
cout << '1' << endl;
} else
cout << "Boring!" << endl;
nums.clear();
}
return 0;
}