import java.util.*;
import static java.lang.System.*;
public class main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNextLong())
{
long n = sc.nextLong();
long m = sc.nextLong();
boolean flag = m == 1 ? false : true;
List num = new ArrayList();
while(flag)
{
num.add(n);
if(n == 1)
break;
else if(n % m == 0)
n /= m;
else
{
flag = false;
break;
}
}
if(flag)
{
for(int i = 0; i < num.size(); i++)
{
System.out.print(num.get(i));
if(i != num.size() - 1)
System.out.print(" ");
}
System.out.println();
}
else
System.out.println("Boring!");
}
}
};
留言
張貼留言