#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
void factors(unsigned long long u, vector<unsigned long long>& fac)
{
unsigned long long s = sqrt(u);
for(unsigned long long i(2); i < s; ++i)
{
if(u % i == 0)
{
fac.push_back(i);
u /= i;
}
}
}
int main()
{
vector<unsigned long long> fac;
unsigned long long num(600851475143);
factors(num, fac);
for(auto i : fac)
cout << i <<endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Y21hdGg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBmYWN0b3JzKHVuc2lnbmVkIGxvbmcgbG9uZyB1LCB2ZWN0b3I8dW5zaWduZWQgbG9uZyBsb25nPiYgZmFjKQp7CiAgICB1bnNpZ25lZCBsb25nIGxvbmcgcyA9IHNxcnQodSk7CiAgICAKICAgIGZvcih1bnNpZ25lZCBsb25nIGxvbmcgaSgyKTsgaSA8IHM7ICsraSkKICAgIHsKICAgICAgICBpZih1ICUgaSA9PSAwKQogICAgICAgIHsKICAgICAgICAgICAgZmFjLnB1c2hfYmFjayhpKTsKICAgICAgICAgICAgdSAvPSBpOwogICAgICAgIH0KICAgIH0KfQoKaW50IG1haW4oKQp7CiAgICB2ZWN0b3I8dW5zaWduZWQgbG9uZyBsb25nPiBmYWM7CiAgICAKICAgIHVuc2lnbmVkIGxvbmcgbG9uZyBudW0oNjAwODUxNDc1MTQzKTsKICAgIAogICAgZmFjdG9ycyhudW0sIGZhYyk7CiAgICAKICAgIGZvcihhdXRvIGkgOiBmYWMpCiAgICAgICAgY291dCA8PCBpIDw8ZW5kbDsKfQo=