#include <bits/stdc++.h>
using namespace std;
#define pb(a) push_back(a)
#define ll long long
#define mod 1000000007
#define N
typedef map<ll,int> Mapp;
Mapp primes;
map<ll, set<ll> > mapp;// to store the divisors
ll n,m,a,b,c,d,k,h,w,x,y,p,q,t,ans,res,ma,mi,T;
map<ll,int> v;
void factorize_n(ll n)
{
	//primes[1]++;
	for(ll i=2;i*i<=n;i++)
	{
		while(n%i==0)
		{
			primes[i]++;
			n/=i;
			//cout<<i<<" ";
		}
	}
	//cout<<n<<endl;
	if(n>1)primes[n]++;
}
void divisors(ll n)
{
	//cout<<n<<endl;
	set<ll> &s=mapp[n];
	if(n==1){s.insert(1);return;}
	set<ll> t;
	// compute divisor list from primes[]
	v.clear();
	//v[1]=1;
	for(Mapp::iterator it=primes.begin();it!=primes.end();it++)
	{
		ll p=it->first,q=it->second;
		for(int i=1,b=p;i<=q;i++,b*=p)
		{
			if(n%b==0)
			{
				v[p]++;
			}
			else break;
		}
	}
	//cout<<"here2"<<endl;
	//now compute s with v
	for(Mapp::iterator it=v.begin();it!=v.end();it++)
	{
		//cout<<"here"<<endl;
		t.clear();
		for(ll i=1,p=it->first,q=it->second,b=it->first;i<=q;b*=p,i++)
		{
			t.insert(b);
			for(set<ll>::iterator jt=s.begin();jt!=s.end();jt++)
			{
				t.insert(b*(*jt));
			}
		}
		for(set<ll>::iterator jt=t.begin();jt!=t.end();jt++)
			s.insert(*jt);
	}
	//cout<<"here3"<<endl;
	s.insert(1);
	//for(set<ll>::iterator jt=s.begin();jt!=s.end();jt++)cout<<*jt<<" ";
	//cout<<endl;
}
void dfs(ll n,ll rep)
{
	//cout<<"here"<<endl;
	if(mapp.find(n)==mapp.end())
		{
			divisors(n);// fills mapp with divisors of n
		}
	if(rep==1)
	{
		for(set<ll>::iterator it=mapp[n].begin();it!=mapp[n].end();it++)
		{
			cout<<*it<<" ";c++;
			if(c==100000)return;
		}
		return;
	}
	for(set<ll>::iterator it=mapp[n].begin();it!=mapp[n].end();it++)
	{
		dfs(*it,rep-1);
		if(c==100000)return;
	}
}
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	cin>>n>>k;
	if(k==0){cout<<n;return 0;}
	if(n==1){cout<<1;return 0;}
	factorize_n(n);//all prime factors of n. Fill primes[]//at most 20 primes
	k=min(k,100000ll);
	dfs(n,k);//dfs style
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define MAX 1000005

ll x,k;
vector<ll> alldiv[MAX];
vector<ll> xdiv,v;
map<ll,int>mp;

void seive()
{
    for(int i=0;i<xdiv.size();i++){
        for(int j=i+1;j<xdiv.size();j++){
            if(xdiv[j]%xdiv[i]==0){
                alldiv[j].push_back(xdiv[i]);
                //if(j!=(xdiv[i]/j))alldiv[i].push_back((xdiv[i]/j));
            }
        }
    }
    for(int i=0;i<7000;i++)sort(alldiv[i].begin(),alldiv[i].end());
}

void go(ll val,int depth)
{
    //cout<<val<<' '<<depth<<endl;
    if(v.size()>=(int)1e5)return ;
    if(val==1 || (depth==0)){v.push_back(val);return ;}
    if(val==x){
        for(auto d : xdiv){
            go(d,depth-1);
        }
    }
    else{
        int pos=mp[val];
        for(auto d : alldiv[pos]){
            go(d,depth-1);
        }
    }
}

int main()
{
   // freopen("input.txt","r",stdin);
    cin>>x>>k;
    if(k==0 || x==1)return cout<<x<<endl,0;

    for(ll i=1;i*i<=x;i++){
        if(x%i==0){
            xdiv.push_back(i);
            if(i != (x/i))xdiv.push_back(x/i);
        }
    }
    sort(xdiv.begin(),xdiv.end());
    for(int i=0;i<xdiv.size();i++)mp[xdiv[i]]=i;
    seive();
    //cout<<"here"<<endl;

    k=min(k,(long long)1e5);
    go(x,(int)k);

    int sz=min((int)1e5,(int)v.size());
    for(int i=0;i<sz;i++)
        printf("%lld ",v[i]);
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define MAX 1000005

ll x,k;
vector<ll> alldiv[MAX];
vector<ll> xdiv,v;
map<ll,int>mp;

void seive()
{
    for(int i=0;i<xdiv.size()-1;i++){
        alldiv[i].push_back(xdiv[i]);
        for(int j=i+1;j<xdiv.size()-1;j++){
            if(xdiv[j]%xdiv[i]==0){
                alldiv[j].push_back(xdiv[i]);
                //if(j!=(xdiv[i]/j))alldiv[i].push_back((xdiv[i]/j));
            }
        }
    }
    for(int i=0;i<7000;i++)sort(alldiv[i].begin(),alldiv[i].end());
//    for(auto xx : xdiv)cout<<xx<<' ';
//    cout<<endl;
//    for(int i=0;i<=2;i++){
//        cout<<i<<"  : ";
//        for(int j=0;j<alldiv[i].size();j++)
//            cout<<alldiv[i][j]<<' ';
//        cout<<endl;
//    }
}

void go(ll val,int depth)
{
    //cout<<val<<' '<<depth<<endl;
    if(v.size()>=(int)1e5)return ;
    if(val==1 || (depth==0)){v.push_back(val);return ;}
    if(val==x){
        for(auto d : xdiv){
            go(d,depth-1);
        }
    }
    else{
        int pos=mp[val];
        for(auto d : alldiv[pos]){
            go(d,depth-1);
        }
    }
}

int main()
{
   // freopen("input.txt","r",stdin);
    cin>>x>>k;
    if(k==0 || x==1)return cout<<x<<endl,0;

    for(ll i=1;i*i<=x;i++){
        if(x%i==0){
            xdiv.push_back(i);
            if(i != (x/i))xdiv.push_back(x/i);
        }
    }
    sort(xdiv.begin(),xdiv.end());
    for(int i=0;i<xdiv.size();i++)mp[xdiv[i]]=i;
    seive();
    //cout<<"here"<<endl;

    k=min(k,(long long)1e5);
    go(x,(int)k);

    int sz=min((int)1e5,(int)v.size());
    for(int i=0;i<sz;i++)
        printf("%lld ",v[i]);
}


#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define MAX 100005

ll x,k;
vector<ll> alldiv[MAX];
vector<ll> xdiv,v;
map<ll,int>mp;

void seive()
{
    for(int i=1;i<xdiv.size();i++){
        for(int j=1;j*j<=xdiv[i];j++){
            if(xdiv[i]%j==0){
                alldiv[i].push_back(j);
                if(j!=(xdiv[i]/j))alldiv[i].push_back((xdiv[i]/j));
            }
        }
        sort(alldiv[i].begin(),alldiv[i].end());
    }
}

void go(int val,int depth)
{
    if(v.size()>=(int)1e5)return ;
    if(val==1 || (depth==0)){v.push_back(val);return ;}
    if(val==x){
        for(auto d : xdiv){
            go(d,depth-1);
        }
    }
    else{
        int pos=mp[val];
        for(auto d : alldiv[pos]){
            go(d,depth-1);
        }
    }
}

int main()
{
    //freopen("input.txt","r",stdin);
    cin>>x>>k;
    if(k==0 || x==1)return cout<<x<<endl,0;

    for(ll i=1;i*i<=x;i++){
        if(x%i==0){
            xdiv.push_back(i);
            if(i != (x/i))xdiv.push_back(x/i);
        }
    }
    sort(xdiv.begin(),xdiv.end());
    for(int i=0;i<xdiv.size();i++)mp[xdiv[i]]=i;
    seive();

    k=min(k,(long long)1e5);
    go(x,(int)k);

    int sz=min((int)1e5,(int)v.size());
    for(int i=0;i<sz;i++)
        printf("%lld ",v[i]);
}


#include <bits/stdc++.h>
using namespace std;

#if !ONLINE_JUDGE
#include "debug.h"
#else
#endif

typedef long long int LL;
typedef unsigned long long LLU;
typedef long double LD;

#define INF 1500000000000000000LL
#define MOD 1000000007
#define F first
#define S second
#define PB push_back
#define MK make_pair
#define LEN(vale) strlen(vale)
#define SZ(vale) (int)vale.size()
#define SQ(A) ((A)*(A))
#define FI(i,fa,fb) for(int i=fa;i<fb;++i)
#define FD(i,fa,fb) for(int i=fa;i>fb;--i)
#define FT(it,S) for(it = (S).begin(); it != (S).end(); ++it)
#define bits(vale) __builtin_popcount(vale)
#define VT vector

#define SET1(array,val,sz) for(int i=0;i<sz;i++)array[i]=val;
#define SET2(array,val,sz1,sz2) for(int i=0;i<sz1;i++)for(int j=0;j<sz2;j++)array[i][j]=val;

#define ALL(a) a.begin(),a.end()
#define LB (lower_bound)
#define UB (upper_bound)

#define SI(vale) scanf("%d",&vale)
#define PI(vale) printf("%d\n",vale)
#define PIS(vale) printf("%d ",vale)
#define SL(vale) scanf("%lld",&vale)
#define PL(vale) printf("%lld\n",vale)
#define PLS(vale) printf("%lld ",vale)
#define SS(vale) scanf("%s",vale)
#define PS(vale) printf("%s\n",vale)
#define NL printf("\n")
#define PLD(vale) cout << fixed; cout.precision(12); cout << vale <<"\n"
#define TCS() int testcase; SI(testcase);while(testcase--)

typedef pair<int,int> PR;
bool deb = false;
const int N = 100011;
LL n,k;
map<LL,VT<LL> >mp;
VT<LL>ans;

void cal(LL nn) {
     VT<LL> v;
     for(LL i = 1;i*i <= nn;i++) {
          if(nn % i == 0) {
               v.PB(i);
               if((nn/i) != i)
                    v.PB(nn/i);
          }
     }
     sort(ALL(v));
     mp[nn] = v;
}

void rec(LL n,LL k) {
     if(SZ(ans) >= 1e5) return ;
     if(k == 0 || n == 1) {
          ans.PB(n);
          return ;
     }
     if(mp.find(n) == mp.end())
          cal(n);
     FI(i,0,SZ(mp[n])) {
          rec(mp[n][i],k-1);
          if(SZ(ans) >= 1e5) break;
     }
}

int main(){
     //clock_t tStart = clock();
     LL k;
     //TCS(){
     SL(n),SL(k);
     rec(n,k);
     FI(i,0,SZ(ans)) PLS(ans[i]); NL;
     //exectime();
     return 0;
}


#include <bits/stdc++.h>
using namespace std;

#if !ONLINE_JUDGE
#include "debug.h"
#else
#endif

typedef long long int LL;
typedef unsigned long long LLU;
typedef long double LD;

#define INF 1500000000000000000LL
#define MOD 1000000007
#define F first
#define S second
#define PB push_back
#define MK make_pair
#define LEN(vale) strlen(vale)
#define SZ(vale) (int)vale.size()
#define SQ(A) ((A)*(A))
#define FI(i,fa,fb) for(int i=fa;i<fb;++i)
#define FD(i,fa,fb) for(int i=fa;i>fb;--i)
#define FT(it,S) for(it = (S).begin(); it != (S).end(); ++it)
#define bits(vale) __builtin_popcount(vale)
#define VT vector

#define SET1(array,val,sz) for(int i=0;i<sz;i++)array[i]=val;
#define SET2(array,val,sz1,sz2) for(int i=0;i<sz1;i++)for(int j=0;j<sz2;j++)array[i][j]=val;

#define ALL(a) a.begin(),a.end()
#define LB (lower_bound)
#define UB (upper_bound)

#define SI(vale) scanf("%d",&vale)
#define PI(vale) printf("%d\n",vale)
#define PIS(vale) printf("%d ",vale)
#define SL(vale) scanf("%lld",&vale)
#define PL(vale) printf("%lld\n",vale)
#define PLS(vale) printf("%lld ",vale)
#define SS(vale) scanf("%s",vale)
#define PS(vale) printf("%s\n",vale)
#define NL printf("\n")
#define PLD(vale) cout << fixed; cout.precision(12); cout << vale <<"\n"
#define TCS() int testcase; SI(testcase);while(testcase--)

typedef pair<int,int> PR;
bool deb = false;
const int N = 100011;
LL n;
VT<LL>ans;
VT<LL>fact;

int main(){
     //clock_t tStart = clock();
     LL k;
     //TCS(){
     SL(n),SL(k);
     if(k == 0 ) {
          PLS(n);
          return 0;
     }
     if(k >= 1e5) {
          FI(i,0,k) PIS(1);
          NL;
          return 0;
     }
     LL p = sqrt(n) + 1;
     FI(i,2,p) {
          if(n % i == 0) {
               fact.PB(i);
               if((n/i) != i)
                    fact.PB(n/(LL)i);
          }
     }
     sort(ALL(fact));
     if(k == 1) {
          if(n != 1)
               PIS(1);
          FI(i,0,SZ(fact)) PLS(fact[i]); PLS(n); NL;
          return 0;
     }
     LL tk = k - 1;
     while(SZ(ans) < 1e5 && tk > 0) {
          ans.PB(1);
          FI(i,0,SZ(fact)) {
               LL ttk = tk;
               while(ttk-- && SZ(ans) < 1e5) {
                    ans.PB(1);
               }
               if(SZ(ans) >= 1e5) break;
               ans.PB(fact[i]);
          }
          tk--;
     }
     if(SZ(ans) < 1e5 && k > 1) {
          ans.PB(1);
          FI(i,0,SZ(fact)) {
               if(SZ(ans) >= 1e5) break;
               ans.PB(fact[i]);
          }
          if(SZ(ans) < 1e5)
               ans.PB(n);
     }

     FI(i,0,min((int)SZ(ans),(int)1e5)) PLS(ans[i]);
     NL;

     //exectime();
     return 0;
}


#include <bits/stdc++.h>
using namespace std;

#if !ONLINE_JUDGE
#include "debug.h"
#else
#endif

typedef long long int LL;
typedef unsigned long long LLU;
typedef long double LD;

#define INF 1500000000000000000LL
#define MOD 1000000007
#define F first
#define S second
#define PB push_back
#define MK make_pair
#define LEN(vale) strlen(vale)
#define SZ(vale) (int)vale.size()
#define SQ(A) ((A)*(A))
#define FI(i,fa,fb) for(int i=fa;i<fb;++i)
#define FD(i,fa,fb) for(int i=fa;i>fb;--i)
#define FT(it,S) for(it = (S).begin(); it != (S).end(); ++it)
#define bits(vale) __builtin_popcount(vale)
#define VT vector

#define SET1(array,val,sz) for(int i=0;i<sz;i++)array[i]=val;
#define SET2(array,val,sz1,sz2) for(int i=0;i<sz1;i++)for(int j=0;j<sz2;j++)array[i][j]=val;

#define ALL(a) a.begin(),a.end()
#define LB (lower_bound)
#define UB (upper_bound)

#define SI(vale) scanf("%d",&vale)
#define PI(vale) printf("%d\n",vale)
#define PIS(vale) printf("%d ",vale)
#define SL(vale) scanf("%lld",&vale)
#define PL(vale) printf("%lld\n",vale)
#define PLS(vale) printf("%lld ",vale)
#define SS(vale) scanf("%s",vale)
#define PS(vale) printf("%s\n",vale)
#define NL printf("\n")
#define PLD(vale) cout << fixed; cout.precision(12); cout << vale <<"\n"
#define TCS() int testcase; SI(testcase);while(testcase--)

typedef pair<int,int> PR;
bool deb = false;
const int N = 100011;
LL n;
VT<LL>ans;
VT<LL>fact;

int main(){
     //clock_t tStart = clock();
     LL k;
     //TCS(){
     SL(n),SL(k);
     if(k == 0 ) {
          PLS(n);
          return 0;
     }
     if(k >= 1e5) {
          FI(i,0,1e5) PIS(1);
          NL;
          return 0;
     }
     LL p = sqrt(n) + 1;
     FI(i,2,p) {
          if(n % i == 0) {
               fact.PB(i);
               if((n/i) != i)
                    fact.PB(n/(LL)i);
          }
     }
     sort(ALL(fact));
     if(k == 1) {
          if(n != 1)
               PIS(1);
          FI(i,0,SZ(fact)) PLS(fact[i]); PLS(n); NL;
          return 0;
     }
     LL tk = k - 1;
     while(SZ(ans) < 1e5 && tk > 0) {
          ans.PB(1);
          FI(i,0,SZ(fact)) {
               LL ttk = tk;
               while(ttk-- && SZ(ans) < 1e5) {
                    ans.PB(1);
               }
               if(SZ(ans) >= 1e5) break;
               ans.PB(fact[i]);
          }
          tk--;
     }
     if(SZ(ans) < 1e5 && k > 1) {
          ans.PB(1);
          FI(i,0,SZ(fact)) {
               if(SZ(ans) >= 1e5) break;
               ans.PB(fact[i]);
          }
          if(SZ(ans) < 1e5)
               ans.PB(n);
     }

     FI(i,0,min((int)SZ(ans),(int)1e5)) PLS(ans[i]);
     NL;

     //exectime();
     return 0;
}


#include <bits/stdc++.h>
using namespace std;

#if !ONLINE_JUDGE
#include "debug.h"
#else
#endif

typedef long long int LL;
typedef unsigned long long LLU;
typedef long double LD;

#define INF 1500000000000000000LL
#define MOD 1000000007
#define F first
#define S second
#define PB push_back
#define MK make_pair
#define LEN(vale) strlen(vale)
#define SZ(vale) (int)vale.size()
#define SQ(A) ((A)*(A))
#define FI(i,fa,fb) for(int i=fa;i<fb;++i)
#define FD(i,fa,fb) for(int i=fa;i>fb;--i)
#define FT(it,S) for(it = (S).begin(); it != (S).end(); ++it)
#define bits(vale) __builtin_popcount(vale)
#define VT vector

#define SET1(array,val,sz) for(int i=0;i<sz;i++)array[i]=val;
#define SET2(array,val,sz1,sz2) for(int i=0;i<sz1;i++)for(int j=0;j<sz2;j++)array[i][j]=val;

#define ALL(a) a.begin(),a.end()
#define LB (lower_bound)
#define UB (upper_bound)

#define SI(vale) scanf("%d",&vale)
#define PI(vale) printf("%d\n",vale)
#define PIS(vale) printf("%d ",vale)
#define SL(vale) scanf("%lld",&vale)
#define PL(vale) printf("%lld\n",vale)
#define PLS(vale) printf("%lld ",vale)
#define SS(vale) scanf("%s",vale)
#define PS(vale) printf("%s\n",vale)
#define NL printf("\n")
#define PLD(vale) cout << fixed; cout.precision(12); cout << vale <<"\n"
#define TCS() int testcase; SI(testcase);while(testcase--)

typedef pair<int,int> PR;
bool deb = false;
const int N = 100011;
LL n;
VT<LL>ans;
VT<LL>fact;

int main(){
     //clock_t tStart = clock();
     LL k;
     //TCS(){
     SL(n),SL(k);
     if(k == 0 ) {
          PLS(n);
          return 0;
     }
     if(k >= 1e5) {
          FI(i,0,k) PIS(1);
          NL;
          return 0;
     }
     LL p = sqrt(n) + 1;
     FI(i,2,p) {
          if(n % i == 0) {
               fact.PB(i);
               if((n/i) != i)
                    fact.PB(n/i);
          }
     }
     sort(ALL(fact));
     if(k == 1) {
          PIS(1);
          FI(i,0,SZ(fact)) PLS(fact[i]); PLS(n); NL;
          return 0;
     }
     LL tk = k - 1;
     while(SZ(ans) < 1e5 && tk > 0) {
          ans.PB(1);
          FI(i,0,SZ(fact)) {
               LL ttk = tk;
               while(ttk-- && SZ(ans) < 1e5) {
                    ans.PB(1);
               }
               if(SZ(ans) >= 1e5) break;
               ans.PB(fact[i]);
          }
          tk--;
     }
     if(SZ(ans) < 1e5 && k > 1) {
          ans.PB(1);
          FI(i,0,SZ(fact)) {
               if(SZ(ans) >= 1e5) break;
               ans.PB(fact[i]);
          }
          if(SZ(ans) < 1e5)
               ans.PB(n);
     }

     FI(i,0,min((int)SZ(ans),(int)1e5)) PLS(ans[i]);
     NL;

     //exectime();
     return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k, ite;
};

int main()
{
    ll n, k;
    cin >> n >> k;

    if(k > lim*2)
    {
        for(ll i=0; i<lim; i++)
            cout << 1 << endl;
        return 0;
    }

    calcDiv(n);

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k, 0});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        int i = pila.front().ite;
        pila.pop_front();

        if(k)
        {
            if(i<divisores[n].size())
            {
                pila.push_front({n, k, i+1});
                pila.push_front({divisores[n][i], k-1, 0});
                while(pila.size() > 2*lim)
                    pila.pop_back();
            }
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        cout << referencia[res[i]] << " ";
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

map<ll, vector<ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    stack <ll> g;
    ll i;
    for(i=1; i*i < n; i++)
    {
        if(n%i == 0)
        {
            d.push_back(i);
            g.push(n/i);
        }
    }
    if(n%i == 0 && i < g.top())
        d.push_back(i);

    while(g.size())
    {
            d.push_back(g.top());
        g.pop();
    }

    divisores[n] = d;

    for(int i=d.size()-1; i>=0; i--)
    {
        vector <ll> div;
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                div.push_back(d[j]);
        divisores[d[i]] = div;
    }
}

int lim = 100000;
int usados;
vector <ll> res;

void recursion(ll n, ll k)
{
    //cout << n << " " << k << endl;
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
            {
                //cout << endl << "Desde " << n << " llamo a " << i << endl;
                recursion(i, k-1);
            }
    }

    if(k == 0 && usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

int main()
{
    ll n, k;
    cin >> n >> k;

    calcDiv(n);

    usados = 0;
    recursion(n, k);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

map<ll, vector<ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    divisores[n] = d;

    for(int i=0; i<d.size(); i++)
    {
        vector <ll> div;
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                div.push_back(d[j]);
        divisores[d[i]] = div;
    }
}

int lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k, ite;
};

int main()
{
    ll n, k;
    cin >> n >> k;

    calcDiv(n);

    usados = 0;
    //recursion(n, k);

    stack <estado> pila;
    stack <int> res;
    pila.push({n, k, 0});
    while(usados < lim && pila.size())
    {
        k = pila.top()._k;
        n = pila.top().num;
        int i = pila.top().ite;
        pila.pop();

        if(k)
        {
            if(i<divisores[n].size())
            {
                pila.push({divisores[n][i], k-1, 0});
                pila.push({n, k, i+1});
            }
        }
        else if(usados < lim)
        {
            usados++;
            res.push(n);
        }
    }

    while(res.size())
    {
        cout << res.top() << " ";
        res.pop();
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k;
    estado(const ll &a, const ll &b)
    {
        num = a, _k = b;
    }
};

int main()
{
    ll n, k;
    scanf("%I64d %I64d", &n, &k);

    if(n == 1)
    {
        printf("1\n");
        return 0;
    }

    calcDiv(n);
    if(k > lim+10000)
    {
        for(ll i=0; i<lim; i++)
            printf("1 ");
        printf("\n");
        return 0;
    }

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        pila.pop_front();

        //cout << "Saco de pila " << n << " con k " << k << " y tam pila " << pila.size() << endl;
        //cout << referencia[n] << " tiene " << divisores[n].size() << " divisores: ";
        //cout << referencia[divisores[n][0]] << endl;

        if(k)
        {
            if(referencia[n] == 1)
            {
                pila.emplace_front(n, 0);
            }
            else
                for(int i=divisores[n].size()-1; pila.size() < lim && i>=0; i--)
                    pila.emplace_front(divisores[n][i], k-1);
            while(pila.size() > lim)
                pila.pop_back();
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        printf("%I64d ", referencia[res[i]]);
    printf("\n");

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k;
};

int main()
{
    ll n, k;
    scanf("%I64d %I64d", &n, &k);

    if(n == 1)
    {
        printf("1\n");
        return 0;
    }

    calcDiv(n);
    if(k > lim+10000)
    {
        for(ll i=0; i<lim; i++)
            printf("1 ");
        printf("\n");
        return 0;
    }

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        pila.pop_front();

        if(k)
        {
            for(int i=divisores[n].size()-1; pila.size() < lim && i>=0; i--)
                pila.push_front({divisores[n][i], k-1});
            while(pila.size() > lim)
                pila.pop_back();
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        printf("%I64d ", referencia[res[i]]);
    printf("\n");

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k, ite;
};

int main()
{
    ll n, k;
    cin >> n >> k;

    if(k > lim*2)
    {
        for(ll i=0; i<lim; i++)
            cout << 1 << endl;
        return 0;
    }

    calcDiv(n);

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k, 0});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        int i = pila.front().ite;
        pila.pop_front();

        if(k)
        {
            if(i<divisores[n].size())
            {
                pila.push_front({n, k, i+1});
                pila.push_front({divisores[n][i], k-1, 0});
                while(pila.size() > lim)
                    pila.pop_back();
            }
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        cout << referencia[res[i]] << " ";
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

int lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k, ite;
};

int main()
{
    ll n, k;
    cin >> n >> k;

    calcDiv(n);

    usados = 0;
    //recursion(n, k);

    stack <estado> pila;
    vector <int> res;
    pila.push({divisores.size()-1, k, 0});
    while(usados < lim && pila.size())
    {
        k = pila.top()._k;
        n = pila.top().num;
        int i = pila.top().ite;
        pila.pop();

        if(k)
        {
            if(i<divisores[n].size() && pila.size() < 2*lim)
            {
                pila.push({n, k, i+1});
                pila.push({divisores[n][i], k-1, 0});
            }
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    for(auto i:res)
        cout << referencia[i] << " ";
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k;
};

int main()
{
    ll n, k;
    scanf("%I64d %I64d", &n, &k);

    if(n == 1)
    {
        printf("1\n");
        return 0;
    }

    calcDiv(n);
    if(k > lim+10000)
    {
        for(ll i=0; i<lim; i++)
            printf("1 ");
        printf("\n");
        return 0;
    }

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        pila.pop_front();

        if(k)
        {
            for(int i=divisores[n].size()-1; i>=0; i--)
                pila.push_front({divisores[n][i], k-1});
            while(pila.size() > lim*2)
                pila.pop_back();
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        printf("%d ", referencia[res[i]]);
    printf("\n");

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
        {
            if(usados < lim)
                recursion(i, k-1);
            else
                return;
        }
    }
    else if(usados < lim)
    {
        usados++;
        cout << referencia[n] << " ";
    }
}

int main()
{
    ll n, k;
    scanf("%I64d %I64d", &n, &k);

    if(n == 1)
    {
        printf("1\n");
        return 0;
    }

    calcDiv(n);
    if(k > lim+10000)
    {
        for(ll i=0; i<lim; i++)
            printf("1 ");
        printf("\n");
        return 0;
    }

    usados = 0;
    recursion(divisores.size()-1, k);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;

struct estado
{
    ll num, _k;
    estado(const ll &a, const ll &b)
    {
        num = a, _k = b;
    }
};

int main()
{
    ll n, k;
    scanf("%I64d %I64d", &n, &k);

    if(n == 1)
    {
        printf("1\n");
        return 0;
    }

    calcDiv(n);
    if(k > lim+10000)
    {
        for(ll i=0; i<lim; i++)
            printf("1 ");
        printf("\n");
        return 0;
    }

    deque <estado> pila;
    vector <int> res;
    res.reserve(lim);
    pila.push_front({divisores.size()-1, k});
    while(res.size() < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        pila.pop_front();

        if(k)
        {
            if(referencia[n] == 1)
                res.push_back(n);
            else
                for(int i=divisores[n].size()-1; i>=0; i--)
                    pila.emplace_front(divisores[n][i], k-1);
        }
        else if(res.size() < lim)
            res.push_back(n);
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        printf("%I64d ", referencia[res[i]]);
    printf("\n");

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k;
};

int main()
{
    ll n, k;
    scanf("%I64d %I64d", &n, &k);

    if(n == 1)
    {
        printf("1\n");
        return 0;
    }

    calcDiv(n);
    if(k > lim+10000)
    {
        for(ll i=0; i<lim; i++)
            printf("1 ");
        printf("\n");
        return 0;
    }

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        pila.pop_front();

        if(k)
        {
            for(int i=divisores[n].size()-1; i>=0; i--)
                pila.push_front({divisores[n][i], k-1});
            while(pila.size() > lim)
                pila.pop_back();
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        printf("%d ", referencia[res[i]]);
    printf("\n");

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

int lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k, ite;
};

int main()
{
    ll n, k;
    cin >> n >> k;

    calcDiv(n);

    usados = 0;
    //recursion(n, k);

    stack <estado> pila;
    vector <int> res;
    pila.push({divisores.size()-1, k, 0});
    while(usados < lim && pila.size())
    {
        k = pila.top()._k;
        n = pila.top().num;
        int i = pila.top().ite;
        pila.pop();

        if(k)
        {
            if(i<divisores[n].size())
            {
                pila.push({n, k, i+1});
                pila.push({divisores[n][i], k-1, 0});
            }
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    for(auto i:res)
        cout << referencia[i] << " ";
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

int lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k, ite;
};

int main()
{
    ll n, k;
    cin >> n >> k;

    if(k > lim*2)
    {
        for(int i=0; i<lim; i++)
            cout << 1 << endl;
        return 0;
    }

    calcDiv(n);

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k, 0});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        int i = pila.front().ite;
        pila.pop_front();

        if(k)
        {
            if(i<divisores[n].size())
            {
                pila.push_front({n, k, i+1});
                pila.push_front({divisores[n][i], k-1, 0});
                while(pila.size() > lim)
                    pila.pop_back();
            }
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    for(auto i:res)
        cout << referencia[i] << " ";
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

int lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k, ite;
};

int main()
{
    ll n, k;
    cin >> n >> k;

    calcDiv(n);

    usados = 0;
    //recursion(n, k);

    stack <estado> pila;
    stack <int> res;
    pila.push({divisores.size()-1, k, 0});
    while(usados < lim && pila.size())
    {
        k = pila.top()._k;
        n = pila.top().num;
        int i = pila.top().ite;
        pila.pop();

        if(k)
        {
            if(i<divisores[n].size())
            {
                pila.push({divisores[n][i], k-1, 0});
                pila.push({n, k, i+1});
            }
        }
        else if(usados < lim)
        {
            usados++;
            res.push(n);
        }
    }

    while(res.size())
    {
        cout << referencia[res.top()] << " ";
        res.pop();
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k;
};

int main()
{
    ll n, k;
    scanf("%I64d %I64d", &n, &k);

    if(n == 1)
    {
        printf("1\n");
        return 0;
    }

    calcDiv(n);
    if(k > lim+10000)
    {
        for(ll i=0; i<lim; i++)
            printf("1 ");
        printf("\n");
        return 0;
    }

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        pila.pop_front();

        if(k)
        {
            for(int i=divisores[n].size()-1; i>=0; i--)
                pila.push_front({divisores[n][i], k-1});
            while(pila.size() > lim*2)
                pila.pop_back();
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        printf("%I64d ", referencia[res[i]]);
    printf("\n");

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

int lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k, ite;
};

int main()
{
    ll n, k;
    cin >> n >> k;

    if(k > lim)
    {
        for(int i=0; i<lim; i++)
            cout << 1 << endl;
        return 0;
    }

    calcDiv(n);

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k, 0});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        int i = pila.front().ite;
        pila.pop_front();

        if(k)
        {
            if(i<divisores[n].size())
            {
                pila.push_front({n, k, i+1});
                pila.push_front({divisores[n][i], k-1, 0});
                while(pila.size() > lim)
                    pila.pop_back();
            }
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    for(auto i:res)
        cout << referencia[i] << " ";
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;

struct estado
{
    ll num, _k;
    estado(const ll &a, const ll &b)
    {
        num = a, _k = b;
    }
};

int main()
{
    ll n, k;
    scanf("%I64d %I64d", &n, &k);

    if(n == 1)
    {
        printf("1\n");
        return 0;
    }

    calcDiv(n);
    if(k > lim+10000)
    {
        for(ll i=0; i<lim; i++)
            printf("1 ");
        printf("\n");
        return 0;
    }

    stack <estado> pila;
    vector <int> res;
    res.reserve(lim);
    pila.emplace(divisores.size()-1, k);
    while(res.size() < lim && pila.size())
    {
        k = pila.top()._k;
        n = pila.top().num;
        pila.pop();

        if(k)
        {
            if(referencia[n] == 1)
                res.push_back(n);
            else
                for(int i=divisores[n].size()-1; i>=0; i--)
                    pila.emplace(divisores[n][i], k-1);
        }
        else if(res.size() < lim)
            res.push_back(n);
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        printf("%I64d ", referencia[res[i]]);
    printf("\n");

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

int lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k, ite;
};

int main()
{
    ll n, k;
    cin >> n >> k;

    calcDiv(n);

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k, 0});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        int i = pila.front().ite;
        pila.pop_front();

        if(k)
        {
            if(i<divisores[n].size())
            {
                pila.push_front({n, k, i+1});
                pila.push_front({divisores[n][i], k-1, 0});
                while(pila.size() > lim)
                    pila.pop_back();
            }
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    for(auto i:res)
        cout << referencia[i] << " ";
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;
int usados;

void recursion(ll n, ll k)
{
    if(k)
    {
        for(const auto &i:divisores[n])
            if(usados <= lim)
                recursion(i, k-1);
    }
    else if(usados < lim)
    {
        usados++;
        cout << n << " ";
    }
}

struct estado
{
    ll num, _k, ite;
};

int main()
{
    ll n, k;
    cin >> n >> k;

    if(n == 1)
    {
        cout << 1 << endl;
        return 0;
    }

    if(k > lim*2)
    {
        for(ll i=0; i<lim; i++)
            cout << 1 << endl;
        return 0;
    }

    calcDiv(n);

    usados = 0;
    //recursion(n, k);

    deque <estado> pila;
    vector <int> res;
    pila.push_front({divisores.size()-1, k, 0});
    while(usados < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        int i = pila.front().ite;
        pila.pop_front();

        if(k)
        {
            if(i<divisores[n].size())
            {
                pila.push_front({n, k, i+1});
                pila.push_front({divisores[n][i], k-1, 0});
                while(pila.size() > 2*lim)
                    pila.pop_back();
            }
        }
        else if(usados < lim)
        {
            usados++;
            res.push_back(n);
        }
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        cout << referencia[res[i]] << " ";
    cout << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define ll long long

vector <ll> referencia;
vector <vector <ll> > divisores;

void calcDiv(ll n)
{
    vector <ll> d;
    set <ll> g;
    for(ll i=1; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            g.insert(i);
            g.insert(n/i);
        }
    }

    d.reserve(g.size());

    for(const auto &i:g)
        d.push_back(i);

    referencia = d;
    divisores.resize(d.size());

    for(int i=0; i<d.size(); i++)
        for(int j=0; j<=i; j++)
            if(d[i]%d[j] == 0)
                divisores[i].push_back(j);
}

ll lim = 100000;

struct estado
{
    ll num, _k;
    estado(const ll &a, const ll &b)
    {
        num = a, _k = b;
    }
};

int main()
{
    ll n, k;
    scanf("%I64d %I64d", &n, &k);

    if(n == 1)
    {
        printf("1\n");
        return 0;
    }

    calcDiv(n);
    if(k > lim+10000)
    {
        for(ll i=0; i<lim; i++)
            printf("1 ");
        printf("\n");
        return 0;
    }

    deque <estado> pila;
    vector <int> res;
    res.reserve(lim);
    pila.push_front({divisores.size()-1, k});
    while(res.size() < lim && pila.size())
    {
        k = pila.front()._k;
        n = pila.front().num;
        pila.pop_front();

        if(k)
        {
            if(referencia[n] == 1)
                res.push_back(n);
            else
                for(int i=divisores[n].size()-1; pila.size() < lim && i>=0; i--)
                    pila.emplace_front(divisores[n][i], k-1);
        }
        else if(res.size() < lim)
            res.push_back(n);
    }

    int tam = min(lim, (ll)res.size());
    for(int i=0; i<tam; i++)
        printf("%I64d ", referencia[res[i]]);
    printf("\n");

    return 0;
}


//*
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <functional>
#define MOD 1000000007
#define MAX ((1<<30)-1)
#define MAX2 ((1ll<<62)-1)
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef set<int>::iterator siit;

ll n, m;
ll yak[3000];
int yaki;

ll a[3000][3000];
int ai[3000];

ll dab[200000];
int dabi;

void back(ll x, ll y)
{
	if(y == 0)
	{
		dab[dabi++]=yak[x];
		return;
	}
	int i, j;
	for(i=0;i<ai[x];i++)
	{
		back(a[x][i], y-1);
		if(dabi >= 100000) return;
	}
}

int main()
{
	ll i, j, k;
	scanf("%I64d%I64d", &n, &m);
	if(n == 1)
	{
		printf("1");
		return 0;
	}
	m=min(m, 100000ll);
	for(i=1;i*i<=n;i++)
	{
		if(n%i == 0)
		{
			yak[yaki++]=i;
			yak[yaki++]=n/i;
		}
	}
	sort(yak, yak+yaki);
	yaki=unique(yak, yak+yaki)-yak;
	for(i=0;i<yaki;i++)
	{
		for(j=0;j<yaki;j++)
		{
			if(yak[i]%yak[j] == 0) a[i][ai[i]++]=j;
		}
	}
	back(yaki-1, m);
	for(i=0;i<min(100000, dabi);i++) printf("%I64d ", dab[i]);
	return 0;
}
//*/


//*
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <functional>
#define MOD 1000000007
#define MAX ((1<<30)-1)
#define MAX2 ((1ll<<62)-1)
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef set<int>::iterator siit;

ll n, m;
ll yak[7000];
int yaki;

vector<ll> a[7000];
int ai[7000];

ll dab[200000];
int dabi;

void back(ll x, ll y)
{
	if(y == 0)
	{
		dab[dabi++]=yak[x];
		return;
	}
	int i, j;
	for(i=0;i<a[x].size();i++)
	{
		back(a[x][i], y-1);
		if(dabi >= 100000) return;
	}
}

int main()
{
	ll i, j, k;
	scanf("%I64d%I64d", &n, &m);
	if(n == 1)
	{
		printf("1");
		return 0;
	}
	m=min(m, 100000ll);
	for(i=1;i*i<=n;i++)
	{
		if(n%i == 0)
		{
			yak[yaki++]=i;
			yak[yaki++]=n/i;
		}
	}
	sort(yak, yak+yaki);
	yaki=unique(yak, yak+yaki)-yak;
	for(i=0;i<yaki;i++)
	{
		for(j=0;j<yaki;j++)
		{
			if(yak[i]%yak[j] == 0) a[i].push_back(j);
		}
	}
	back(yaki-1, m);
	for(i=0;i<min(100000, dabi);i++) printf("%I64d ", dab[i]);
	return 0;
}
//*/


//*
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <functional>
#define MOD 1000000007
#define MAX ((1<<30)-1)
#define MAX2 ((1ll<<62)-1)
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef set<int>::iterator siit;

ll n, m;
ll yak[7000];
int yaki;

vector<ll> a[7000];
int ai[7000];

ll dab[200000];
int dabi;

void back(int x, int y)
{
	if(y == 0 || x == 0)
	{
		dab[dabi++]=yak[x];
		return;
	}
	int i;
	for(i=0;i<=x;i++)
	{
		if(yak[x]%yak[i] == 0) back(i, y-1);
		if(dabi >= 100000) return;
	}
}

int main()
{
	ll i, j, k;
	scanf("%I64d%I64d", &n, &m);
	if(n == 1)
	{
		printf("1");
		return 0;
	}
	m=min(m, 100000ll);
	for(i=1;i*i<=n;i++)
	{
		if(n%i == 0)
		{
			yak[yaki++]=i;
			yak[yaki++]=n/i;
		}
	}
	sort(yak, yak+yaki);
	yaki=unique(yak, yak+yaki)-yak;
	back(yaki-1, m);
	for(i=0;i<min(100000, dabi);i++) printf("%I64d ", dab[i]);
	return 0;
}
//*/


//*
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <functional>
#define MOD 1000000007
#define MAX ((1<<30)-1)
#define MAX2 ((1ll<<62)-1)
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef set<int>::iterator siit;

ll n, m;
ll yak[7000];
int yaki;

vector<ll> a[7000];
int ai[7000];

ll dab[200000];
int dabi;

void back(int x, int y)
{
	if(y == 0)
	{
		dab[dabi++]=yak[x];
		return;
	}
	int i;
	for(i=0;i<yaki;i++)
	{
		if(yak[x]%yak[i] == 0) back(i, y-1);
		if(dabi >= 100000) return;
	}
}

int main()
{
	ll i, j, k;
	scanf("%I64d%I64d", &n, &m);
	if(n == 1)
	{
		printf("1");
		return 0;
	}
	m=min(m, 100000ll);
	for(i=1;i*i<=n;i++)
	{
		if(n%i == 0)
		{
			yak[yaki++]=i;
			yak[yaki++]=n/i;
		}
	}
	sort(yak, yak+yaki);
	yaki=unique(yak, yak+yaki)-yak;
	back(yaki-1, m);
	for(i=0;i<min(100000, dabi);i++) printf("%I64d ", dab[i]);
	return 0;
}
//*/


#include <bits/stdc++.h>
#define pi acos(-1)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const LL ll_INF = 0x3f3f3f3f3f3f3f3f;//4e18 ~= 2^62
const int N =1e5 + 10;
const LL mod = 1e9+7;
LL x, k, flag=1;
int len;
LL a[N];
void dfs(LL x, LL step)
{
    if(step > k) return;
    if(flag>100000LL) return;

    if(step==k || x==1){
        if(flag>100000LL) return;
        printf("%I64d%c", x, " \n"[step==k&&x==a[len-1]]);
        flag++;
        return;
    }
    for(int i=0; i<len; i++){
        LL v = a[i];
        if(v>x) break;
        if(x%v==0)
            dfs(v, step+1);
    }
}

int main()
{
    cin >> x >> k;
    len=0;
    for(int i=1; i*i<=x; i++){
        if(i*i==x) a[len++]=i;
        else if(x%i==0) a[len++]=i, a[len++]=x/i;
    }
    sort(a, a+len);
    dfs(x,0);
}


#include <bits/stdc++.h>
#define pi acos(-1)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const LL ll_INF = 0x3f3f3f3f3f3f3f3f;//4e18 ~= 2^62
const int N =1e5 + 10;
const LL mod = 1e9+7;
LL x, k, flag=1;
int len;
LL a[N];
void dfs(LL x, LL step)
{
    if(step > k) return;
    if(flag>100000LL) return;

    if(step==k || x==1){
        if(flag>100000LL) return;
        printf("%I64d%c", x, " \n"[step==k&&x==a[len-1]);
        flag++;
        return;
    }
    for(int i=0; i<len; i++){
        LL v = a[i];
        if(v>x) break;
        if(x%v==0)
            dfs(v, step+1);
    }
}

int main()
{
    cin >> x >> k;
    len=0;
    for(int i=1; i*i<=x; i++){
        if(i*i==x) a[len++]=i;
        else if(x%i==0) a[len++]=i, a[len++]=x/i;
    }
    sort(a, a+len);
    dfs(x,0);
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi (4*atan(1.0))
const int N=2e5+10,M=4e6+10,inf=1e9+10;
ll x,k,flag;
set<ll>s;
set<ll>::iterator it;
ll p[N],len;
void dfs(ll x,ll step)
{
    if(step>k)return;
    if(flag>=100000)return;
    if(step==k||x==1)
    {
        if(flag>=100000)return;
        printf("%I64d ",x);
        flag++;
        return;
    }
    for(ll i=0;i<len;i++)
    {
        ll v=p[i];
        if(v>x)break;
        //cout<<"\n"<<v<<"cccc"<<x<<"   "<<step<<endl;
        if(x%v==0)
            dfs(v,step+1);
    }
}

int main()
{
    scanf("%I64d%I64d",&x,&k);
    len=0;
    for(ll i=1;i*i<=x;i++)
    {
        if(i*i==x)
        p[len++]=i;
        else if(x%i==0)
        p[len++]=i,p[len++]=x/i;
    }
    sort(p,p+len);
    flag=0;
    dfs(x,0);
    return 0;
}


#include <bits/stdc++.h>
#define pi acos(-1)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const LL ll_INF = 0x3f3f3f3f3f3f3f3f;//4e18 ~= 2^62
const int N =1e5 + 10;
const LL mod = 1e9+7;
LL x, k, flag=1;
LL len;
LL a[N];
void dfs(LL x, LL step)
{
    if(step > k) return;
    if(flag>100000LL) return;

    if(step==k || x==1){
        if(flag>100000LL) return;
        printf("%I64d%c", x, " \n"[step==k&&x==a[len-1]]);
        flag++;
        return;
    }
    for(LL i=0; i<len; i++){
        LL v = a[i];
        if(v>x) break;
        if(x%v==0)
            dfs(v, step+1);
    }
}

int main()
{
    cin >> x >> k;
    len=0;
    for(LL i=1; i*i<=x; i++){
        if(i*i==x) a[len++]=i;
        else if(x%i==0) a[len++]=i, a[len++]=x/i;
    }
    sort(a, a+len);
    dfs(x,0);
}


#include <bits/stdc++.h>
#define pi acos(-1)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const LL ll_INF = 0x3f3f3f3f3f3f3f3f;//4e18 ~= 2^62
const int N =1e5 + 10;
const LL mod = 1e9+7;
LL x, k, flag=1;
int len;
LL a[N];
void dfs(int x, int step)
{
    if(step > k) return;
    if(flag>100000LL) return;

    if(step==k || x==1){
        printf("%I64d ", x);
        flag++;
        return;
    }
    for(int i=0; i<len; i++){
        LL v = a[i];
        if(v>x) break;
        if(x%v==0)
            dfs(v, step+1);
    }
}

int main()
{
    cin >> x >> k;
    len=0;
    for(int i=1; i*i<=x; i++){
        if(i*i==x) a[len++]=i;
        else if(x%i==0) a[len++]=i, a[len++]=x/i;
    }
    sort(a, a+len);
    dfs(x,0);
}


#include <bits/stdc++.h>
#define pi acos(-1)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const LL ll_INF = 0x3f3f3f3f3f3f3f3f;//4e18 ~= 2^62
const int N =1e5 + 10;
const LL mod = 1e9+7;
LL x, k, flag=1;
LL len;
LL a[N];
void dfs(LL x, LL step)
{
    if(step > k) return;
    if(flag>100000LL) return;

    if(step==k || x==1){
        if(flag>100000LL) return;
        printf("%I64d%c", x, " \n"[step==k&&x==a[len-1]]);
        flag++;
        return;
    }
    for(LL i=0; i<len; i++){
        LL v = a[i];
        if(v>x) break;
        if(x%v==0)
            dfs(v, step+1);
    }
}

int main()
{
    cin >> x >> k;
    len=0;
    for(int i=1; i*i<=x; i++){
        if(i*i==x) a[len++]=i;
        else if(x%i==0) a[len++]=i, a[len++]=x/i;
    }
    sort(a, a+len);
    dfs(x,0);
}


#include <bits/stdc++.h>
#define pi acos(-1)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const LL ll_INF = 0x3f3f3f3f3f3f3f3f;//4e18 ~= 2^62
const int N =1e5 + 10;
const LL mod = 1e9+7;
LL x, k, flag=1;
int len;
LL a[N];
void dfs(LL x, LL step)
{
    if(step > k) return;
    if(flag>100000LL) return;

    if(step==k || x==1){
        printf("%I64d ", x);
        flag++;
        return;
    }
    for(int i=0; i<len; i++){
        LL v = a[i];
        if(v>x) break;
        if(x%v==0)
            dfs(v, step+1);
    }
}

int main()
{
    cin >> x >> k;
    len=0;
    for(int i=1; i*i<=x; i++){
        if(i*i==x) a[len++]=i;
        else if(x%i==0) a[len++]=i, a[len++]=x/i;
    }
    sort(a, a+len);
    dfs(x,0);
}


#include <bits/stdc++.h>
#define pi acos(-1)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const LL ll_INF = 0x3f3f3f3f3f3f3f3f;//4e18 ~= 2^62
const int N =1e5 + 10;
const LL mod = 1e9+7;
LL x, k, flag=1;
int len;
LL a[N];
void dfs(int x, int step)
{
    if(step > k) return;
    if(flag>100000LL) return;

    if(step==k || x==1){
        printf("%I64d", x);
        flag++;
        return;
    }
    for(int i=0; i<len; i++){
        LL v = a[i];
        if(v>x) break;
        if(x%v==0)
            dfs(v, step+1);
    }
}

int main()
{
    cin >> x >> k;
    len=0;
    for(int i=1; i*i<=x; i++){
        if(i*i==x) a[len++]=i;
        else if(x%i==0) a[len++]=i, a[len++]=x/i;
    }
    sort(a, a+len);
    dfs(x,0);
}


#include <bits/stdc++.h>
using namespace std;
#define ll __int64
ll a[100000],t,cnt;
void DFS(ll n,ll k)
{
	if (cnt>=1e5)
		return;
	if (k==0 || n==1)
	{
		cnt++;
		printf("%I64d ",n);
		return;
	}
	for (ll i=0;n>=a[i];i++)
		if (n % a[i]==0)
			DFS(a[i],k-1);
	return;
}
int main()
{
	t=0;
	ll n,k;
	scanf("%I64d%I64d",&n,&k);
	for (ll i=1;i*i<=n;i++)
		if (n % i==0)
		{
			a[t++]=i;
			if (i!=n/i)
			a[t++]=n/i;
		}
	cnt=0;
	sort(a,a+t);
	DFS(n,k);
	return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef __int64 LL;
const int MAXN = 100000;
LL divisor[MAXN], num;
LL cnt = 0;
void get_divisor(LL x)
{
    num = 0;
    LL tmp = (LL)sqrt(x);
    for(int i = 1; i <= tmp; i++)
    {
        if(x % i == 0){
            divisor[num++] = i;
            if(x / i != i)
                divisor[num++] = x / i;
        }
    }
    sort(divisor, divisor + num);
}

void dfs(LL x, LL k)
{
    //cout << "x = " << x << ", k = " << k << endl;
    if(cnt >= 100000) return ;
    if(k == 0 || x == 1)
    {
        cout << x << " ";
        cnt++;
        return ;
    }
    for(LL i = 0; i < num && divisor[i] <= x; i++)
    {
        if(x % divisor[i] == 0) {
            dfs(divisor[i], k-1);
            if(cnt >= 100000) return ;
        }
    }
}

int main()
{
    LL x, k;
    while(cin >> x >> k)
    {
        get_divisor(x);
        dfs(x, k);
        cout << endl;
    }
    return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef __int64 LL;
const int MAXN = 100000;
LL divisor[MAXN], num;
LL cnt = 0;
void get_divisor(LL x)
{
    num = 0;
    LL tmp = (LL)sqrt(x);
    for(int i = 1; i <= tmp; i++)
    {
        if(x % i == 0){
            divisor[num++] = i;
            if(x / i != i)
                divisor[num++] = x / i;
        }
    }
    sort(divisor, divisor + num);
}

void dfs(LL x, LL k)
{
    //cout << "x = " << x << ", k = " << k << endl;
    if(cnt >= 100000) return ;
    if(k == 0 || x == 1)
    {
        cout << x << " ";
        cnt++;
        return ;
    }
    for(LL i = 0; divisor[i] <= x; i++)
    {
        if(x % divisor[i] == 0) {
            dfs(divisor[i], k-1);
            if(cnt >= 100000) return ;
        }
    }
}

int main()
{
    LL x, k;
    while(cin >> x >> k)
    {
        get_divisor(x);
        dfs(x, k);
        cout << endl;
    }
    return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main()
{
 int i,k,c,n;
 c=1;
 set<int> x;
 set<int>::iterator it;
 vector<int> v;
 cin >> n;
 int a[n+1],b[n+2];
 b[n]=b[n+1]=0;
 a[n]=-2;
 for(i=0;i<n;i++)
 {
  b[i]=0;
  cin >> a[i];
  x.insert(a[i]);
 }
 k=x.size();
 for(it=x.begin();it!=x.end();it++)
 v.push_back(*it);
 for(i=0;i<(v.size()-1);i++)
 {
  if((v[i+1]-v[i])<=2)
  {
   k--;
   i++;
  }
 }
 sort(a,a+n);
 for(i=0;i<n;i++)
 {
  if(a[i]==a[i+1])
  c++;
  else
  {
   b[a[i]]=1;
   if(c==2)
   {
    if(b[a[i]-1]==0)
    b[a[i]-1]=1;
    else
    b[a[i]+1]=1;
   }
   else if(c>2)
   {
    b[a[i]+1]=1;
    b[a[i]-1]=1;
   }
   c=1;
  }
 }
 c=0;
 for(i=1;i<=(n+1);i++)
 {
  //cout << b[i] << " ";
  if(b[i]==1)
  c++;
 }
 cout << k << " " << c;
 return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main()
{
 int i,k,c,n;
 c=1;
 set<int> x;
 set<int>::iterator it;
 vector<int> v;
 cin >> n;
 int a[n+1],b[n+1];
 b[n]=0;
 a[n]=-2;
 for(i=0;i<n;i++)
 {
  b[i]=0;
  cin >> a[i];
  x.insert(a[i]);
 }
 for(i=0;i<n;i++)
 b[a[i]]++;
 k=x.size();
 for(it=x.begin();it!=x.end();it++)
 v.push_back(*it);
 for(i=0;i<(v.size()-1);i++)
 {
  if((v[i+1]-v[i])<=2)
  {
   k--;
   i++;
  }
 }
 sort(a,a+n);

 int max=a[n-1];

 int ans = 0;
	for(int i = 1; i <= max + 1; i++) {
		if(b[i - 1]) b[i - 1]--, ans++;
		else if(b[i]) b[i]--, ans++;
		else if(b[i + 1]) b[i + 1]--, ans++;
	}

 cout << k << " " << ans;
 return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 5e5 + 5;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b, ll mod) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b, ll mod) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b, ll mod) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x, mod), (n - 1) / 2, mod), mod);
    else
        return pwr(mul(x, x, mod), n / 2, mod);
}
ll modInv(ll n, ll mod)
{
    return pwr(n, mod - 2, mod);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}
ll fact[N], invfact[N];

void precompute(ll mod)
{
    fact[0] = fact[1] = 1;
    for (int i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
    invfact[N - 1] = modInv(fact[N - 1], mod);
    for (int i = N - 2; i >= 0; i--)
    {
        invfact[i] = invfact[i + 1] * (i + 1);
        invfact[i] %= mod;
    }
}
int nCr(int x, int y, ll mod)
{
    if (y > x)
        return 0;
    ll num = fact[x];
    num *= invfact[y];
    num %= mod;
    num *= invfact[x - y];
    num %= mod;
    return num;
}
int main()
{
    ll n;
    cin >> n;
    int a[n];
    vector<ll> v(n + 4, 0);
    vector<ll> b(n + 4, 0);
    vector<ll> c(n + 4, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        v[a[i]]++;
        b[a[i]]++;
        c[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (c[i] >= 3)
        {

            v[i - 1] += 1, v[i]--;
            v[i + 1] += 1, v[i]--;
        }
        else if (c[i] == 2)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {

                v[i + 1] += 1;
                v[i]--;
            }
        }
        else if (c[i] == 1)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {
                v[i + 1] += 1;
                v[i]--;
            }
        }
    }
    int m2 = 0, m1 = 0;
    for (int i = 0; i <= n + 1; i++)
    {
        //  cout << v[i] << " ";
        if (v[i] > 0)
            m2++;
    }
    //  cout << endl;
    for (int i = 0; i <= n; i++)
    {
        //cout << b[i] << " ";
        if (!b[i])
            continue;
        i = i + 2;
        m1++;
    }
    //  cout << endl;
    cout << m1 << " " << m2 << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 5e5 + 5;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b, ll mod) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b, ll mod) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b, ll mod) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x, mod), (n - 1) / 2, mod), mod);
    else
        return pwr(mul(x, x, mod), n / 2, mod);
}
ll modInv(ll n, ll mod)
{
    return pwr(n, mod - 2, mod);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}
ll fact[N], invfact[N];

void precompute(ll mod)
{
    fact[0] = fact[1] = 1;
    for (int i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
    invfact[N - 1] = modInv(fact[N - 1], mod);
    for (int i = N - 2; i >= 0; i--)
    {
        invfact[i] = invfact[i + 1] * (i + 1);
        invfact[i] %= mod;
    }
}
int nCr(int x, int y, ll mod)
{
    if (y > x)
        return 0;
    ll num = fact[x];
    num *= invfact[y];
    num %= mod;
    num *= invfact[x - y];
    num %= mod;
    return num;
}
int main()
{
    int n;
    cin >> n;
    int a[n];
    vector<int> v(n + 4, 0);
    vector<int> b(n + 4, 0);
    vector<int> c(n + 4, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        v[a[i]]++;
        b[a[i]]++;
        c[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (v[i] >= 3)
        {

            if (v[i - 1] == 0)
                v[i - 1] = 1, v[i]--;
            if (v[i + 1] == 0)
                v[i + 1] = 1, v[i]--;
        }
        else if (v[i] == 2)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] = 1;
                v[i]--;
            }
            else if (v[i + 1] == 0)
            {

                v[i + 1] = 1;
                v[i]--;
            }
        }
        if (b[i] > 0)
        {
            if (c[i] == b[i])
            {
                if (b[i - 1] > 0)
                {
                    b[i - 1] += c[i];
                    b[i] -= c[i];
                }
                else if (b[i + 1] > 0)
                {
                   // cout << "i " << i << " else " << endl;
                    b[i + 1] += c[i];
                    b[i] -= c[i];
                }
            }
        }
    }
    int m2 = 0, m1 = 0;
    for (int i = 0; i <= n + 1; i++)
    {
       // cout << v[i] << " ";
        if (v[i] > 0)
            m2++;
        if (b[i] > 0)
            m1++;
    }
    // cout << endl;
    // for (int i = 0; i <= n + 1; i++)
    // {
    //     cout << b[i] << " ";
    // }
    // cout << endl;
    cout << m1 << " " << m2 << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 5e5 + 5;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b, ll mod) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b, ll mod) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b, ll mod) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x, mod), (n - 1) / 2, mod), mod);
    else
        return pwr(mul(x, x, mod), n / 2, mod);
}
ll modInv(ll n, ll mod)
{
    return pwr(n, mod - 2, mod);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}
ll fact[N], invfact[N];

void precompute(ll mod)
{
    fact[0] = fact[1] = 1;
    for (int i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
    invfact[N - 1] = modInv(fact[N - 1], mod);
    for (int i = N - 2; i >= 0; i--)
    {
        invfact[i] = invfact[i + 1] * (i + 1);
        invfact[i] %= mod;
    }
}
int nCr(int x, int y, ll mod)
{
    if (y > x)
        return 0;
    ll num = fact[x];
    num *= invfact[y];
    num %= mod;
    num *= invfact[x - y];
    num %= mod;
    return num;
}
int main()
{
    ll n;
    cin >> n;
    int a[n];
    vector<ll> v(n + 4, 0);
    vector<ll> b(n + 4, 0);
    vector<ll> c(n + 4, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        v[a[i]]++;
        b[a[i]]++;
        c[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (c[i] >= 3)
        {

            v[i - 1] += 1, v[i]--;
            v[i + 1] += 1, v[i]--;
        }
        else if (c[i] == 2)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {

                v[i + 1] += 1;
                v[i]--;
            }
        }
        else if (c[i] == 1)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {
                v[i + 1] += 1;
                v[i]--;
            }
        }
        if (c[i] > 0)
        {
            if (c[i] == b[i])
            {
                if (b[i - 1] > 0)
                {
                    b[i - 1] += c[i];
                    b[i] -= c[i];
                }
                else if (b[i + 1] > 0)
                {
                    //cout << "i " << i << " else " << endl;
                    b[i + 1] += c[i];
                    b[i] -= c[i];
                }
            }
        }
    }
    int m2 = 0, m1 = 0;
    for (int i = 0; i <= n + 1; i++)
    {
        //  cout << v[i] << " ";
        if (v[i] > 0)
            m2++;
        if (b[i] > 0)
            m1++;
    }
    //  cout << endl;
    // for (int i = 0; i <= n + 1; i++)
    // {
    //     cout << b[i] << " ";
    // }
    // cout << endl;
    cout << m1 << " " << m2 << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 5e5 + 5;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b, ll mod) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b, ll mod) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b, ll mod) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x, mod), (n - 1) / 2, mod), mod);
    else
        return pwr(mul(x, x, mod), n / 2, mod);
}
ll modInv(ll n, ll mod)
{
    return pwr(n, mod - 2, mod);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}
ll fact[N], invfact[N];

void precompute(ll mod)
{
    fact[0] = fact[1] = 1;
    for (int i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
    invfact[N - 1] = modInv(fact[N - 1], mod);
    for (int i = N - 2; i >= 0; i--)
    {
        invfact[i] = invfact[i + 1] * (i + 1);
        invfact[i] %= mod;
    }
}
int nCr(int x, int y, ll mod)
{
    if (y > x)
        return 0;
    ll num = fact[x];
    num *= invfact[y];
    num %= mod;
    num *= invfact[x - y];
    num %= mod;
    return num;
}
int main()
{
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    sort(arr, arr + n);
    set<int> s;
    for (int i = 0; i < n; i++)
    {
        if (s.find(arr[i] - 1) != s.end())
        {
            continue;
        }
        if (s.find(arr[i]) != s.end())
        {
            continue;
        }
        else
        {
            s.insert(arr[i] + 1);
        }
    }
    int min1 = s.size();
    s.clear();
    for (int i = 0; i < n; i++)
    {
        if (s.find(arr[i] - 1) == s.end())
        {
            s.insert(arr[i] - 1);
            continue;
        }

        if (s.find(arr[i]) == s.end())
        {
            s.insert(arr[i]);
        }
        else
        {
            s.insert(arr[i] + 1);
        }
    }
    int max1 = s.size();
    cout << min1 << ' ' << max1 << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 5e5 + 5;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b, ll mod) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b, ll mod) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b, ll mod) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x, mod), (n - 1) / 2, mod), mod);
    else
        return pwr(mul(x, x, mod), n / 2, mod);
}
ll modInv(ll n, ll mod)
{
    return pwr(n, mod - 2, mod);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}
ll fact[N], invfact[N];

void precompute(ll mod)
{
    fact[0] = fact[1] = 1;
    for (int i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
    invfact[N - 1] = modInv(fact[N - 1], mod);
    for (int i = N - 2; i >= 0; i--)
    {
        invfact[i] = invfact[i + 1] * (i + 1);
        invfact[i] %= mod;
    }
}
int nCr(int x, int y, ll mod)
{
    if (y > x)
        return 0;
    ll num = fact[x];
    num *= invfact[y];
    num %= mod;
    num *= invfact[x - y];
    num %= mod;
    return num;
}
int main()
{
    ll n;
    cin >> n;
    int a[n];
    vector<ll> v(n + 4, 0);
    vector<ll> b(n + 4, 0);
    vector<ll> c(n + 4, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        v[a[i]]++;
        b[a[i]]++;
        c[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (c[i] >= 3)
        {

            v[i - 1] += 1, v[i]--;
            v[i + 1] += 1, v[i]--;
        }
        else if (c[i] == 2)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {

                v[i + 1] += 1;
                v[i]--;
            }
        }
        else if (c[i] == 1)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {
                v[i + 1] += 1;
                v[i]--;
            }
        }
    }
    int m2 = 0, m1 = 0;
    for (int i = 0; i <= n + 1; i++)
    {
        //  cout << v[i] << " ";
        if (v[i] > 0)
            m2++;
    }
    //  cout << endl;
    for (int i = 0; i < n; i++)
    {
        //cout << b[i] << " ";
        if (!b[i])
            continue;
        i = i + 2;
        m1++;
    }
    //  cout << endl;
    cout << m1 << " " << m2 << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 5e5 + 5;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b, ll mod) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b, ll mod) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b, ll mod) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x, mod), (n - 1) / 2, mod), mod);
    else
        return pwr(mul(x, x, mod), n / 2, mod);
}
ll modInv(ll n, ll mod)
{
    return pwr(n, mod - 2, mod);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}
ll fact[N], invfact[N];

void precompute(ll mod)
{
    fact[0] = fact[1] = 1;
    for (int i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
    invfact[N - 1] = modInv(fact[N - 1], mod);
    for (int i = N - 2; i >= 0; i--)
    {
        invfact[i] = invfact[i + 1] * (i + 1);
        invfact[i] %= mod;
    }
}
int nCr(int x, int y, ll mod)
{
    if (y > x)
        return 0;
    ll num = fact[x];
    num *= invfact[y];
    num %= mod;
    num *= invfact[x - y];
    num %= mod;
    return num;
}
int main()
{
    ll n;
    cin >> n;
    int a[n];
    vector<ll> v(n + 4, 0);
    vector<ll> b(n + 4, 0);
    vector<ll> c(n + 4, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        v[a[i]]++;
        b[a[i]]++;
        c[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (c[i] >= 3)
        {

            v[i - 1] += 1, v[i]--;
            v[i + 1] += 1, v[i]--;
        }
        else if (c[i] == 2)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {

                v[i + 1] += 1;
                v[i]--;
            }

        }
        else if (c[i] == 1)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else if (v[i] != c[i])
            {
                v[i + 1] += 1;
                v[i]--;
            }
        }
    }
    int m2 = 0, m1 = 0;
    for (int i = 0; i <= n + 1; i++)
    {
        //  cout << v[i] << " ";
        if (v[i] > 0)
            m2++;
    }
    //  cout << endl;
    for (int i = 0; i <= n; i++)
    {
        //cout << b[i] << " ";
        if (!b[i])
            continue;
        i = i + 2;
        m1++;
    }
    //  cout << endl;
    cout << m1 << " " << m2 << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 5e5 + 5;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b, ll mod) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b, ll mod) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b, ll mod) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x, mod), (n - 1) / 2, mod), mod);
    else
        return pwr(mul(x, x, mod), n / 2, mod);
}
ll modInv(ll n, ll mod)
{
    return pwr(n, mod - 2, mod);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}
ll fact[N], invfact[N];

void precompute(ll mod)
{
    fact[0] = fact[1] = 1;
    for (int i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
    invfact[N - 1] = modInv(fact[N - 1], mod);
    for (int i = N - 2; i >= 0; i--)
    {
        invfact[i] = invfact[i + 1] * (i + 1);
        invfact[i] %= mod;
    }
}
int nCr(int x, int y, ll mod)
{
    if (y > x)
        return 0;
    ll num = fact[x];
    num *= invfact[y];
    num %= mod;
    num *= invfact[x - y];
    num %= mod;
    return num;
}
int main()
{
    int n;
    cin >> n;
    int a[n];
    vector<int> v(n + 4, 0);
    vector<int> b(n + 4, 0);
    vector<int> c(n + 4, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        v[a[i]]++;
        b[a[i]]++;
        c[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (c[i] >= 3)
        {

            v[i - 1] += 1, v[i]--;
            v[i + 1] += 1, v[i]--;
        }
        else if (c[i] == 2)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] = 1;
                v[i]--;
            }
            else
            {

                v[i + 1] += 1;
                v[i]--;
            }
        }
        else if (c[i] == 1)
        {
            if (v[i] != c[i])
            {
                if (v[i - 1] == 0)
                {
                    v[i - 1] += 1;
                    v[i]--;
                }
                else
                {
                    v[i + 1] += 1;
                    v[i]--;
                }
            }
        }
        if (b[i] > 0)
        {
            if (c[i] == b[i])
            {
                if (b[i - 1] > 0)
                {
                    b[i - 1] += c[i];
                    b[i] -= c[i];
                }
                else if (b[i + 1] > 0)
                {
                    // cout << "i " << i << " else " << endl;
                    b[i + 1] += c[i];
                    b[i] -= c[i];
                }
            }
        }
    }
    int m2 = 0, m1 = 0;
    for (int i = 0; i <= n + 1; i++)
    {
        // cout << v[i] << " ";
        if (v[i] > 0)
            m2++;
        if (b[i] > 0)
            m1++;
    }
    // cout << endl;
    // for (int i = 0; i <= n + 1; i++)
    // {
    //     cout << b[i] << " ";
    // }
    // cout << endl;
    cout << m1 << " " << m2 << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define ll long long
#define endl "\n"
#define ar array
#define deb(x) cout << #x << " = " << x << endl
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll N = 5e5 + 5;

template <class T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
inline ll add(ll a, ll b, ll mod) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b, ll mod) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b, ll mod) { return ((a % mod) * (b % mod)) % mod; }
struct comp
{
    bool operator()(const pair<ll, ll> &x, const pair<ll, ll> &y) const
    {
        return x.first < y.first;
    }
};
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwr(ll x, ll n, ll mod)
{
    if (n == 0)
        return 1;
    if (n & 1)
        return mul(x, pwr(mul(x, x, mod), (n - 1) / 2, mod), mod);
    else
        return pwr(mul(x, x, mod), n / 2, mod);
}
ll modInv(ll n, ll mod)
{
    return pwr(n, mod - 2, mod);
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}
ll fact[N], invfact[N];

void precompute(ll mod)
{
    fact[0] = fact[1] = 1;
    for (int i = 2; i < N; i++)
    {
        fact[i] = fact[i - 1] * i;
        fact[i] %= mod;
    }
    invfact[N - 1] = modInv(fact[N - 1], mod);
    for (int i = N - 2; i >= 0; i--)
    {
        invfact[i] = invfact[i + 1] * (i + 1);
        invfact[i] %= mod;
    }
}
int nCr(int x, int y, ll mod)
{
    if (y > x)
        return 0;
    ll num = fact[x];
    num *= invfact[y];
    num %= mod;
    num *= invfact[x - y];
    num %= mod;
    return num;
}
int main()
{
    ll n;
    cin >> n;
    int a[n];
    vector<ll> v(n + 4, 0);
    vector<ll> b(n + 4, 0);
    vector<ll> c(n + 4, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        v[a[i]]++;
        b[a[i]]++;
        c[a[i]]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (c[i] >= 3)
        {

            v[i - 1] += 1, v[i]--;
            v[i + 1] += 1, v[i]--;
        }
        else if (c[i] == 2)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {

                v[i + 1] += 1;
                v[i]--;
            }
        }
        else if (c[i] == 1)
        {

            if (v[i - 1] == 0)
            {
                v[i - 1] += 1;
                v[i]--;
            }
            else
            {
                v[i + 1] += 1;
                v[i]--;
            }
        }
        if (b[i] > 0)
        {
            if (c[i] == b[i])
            {
                if (b[i - 1] > 0)
                {
                    b[i - 1] += c[i];
                    b[i] -= c[i];
                }
                else if (b[i + 1] > 0)
                {
                    // cout << "i " << i << " else " << endl;
                    b[i + 1] += c[i];
                    b[i] -= c[i];
                }
            }
        }
    }
    int m2 = 0, m1 = 0;
    for (int i = 0; i <= n + 1; i++)
    {
        //  cout << v[i] << " ";
        if (v[i] > 0)
            m2++;
        if (b[i] > 0)
            m1++;
    }
    //  cout << endl;
    // for (int i = 0; i <= n + 1; i++)
    // {
    //     cout << b[i] << " ";
    // }
    // cout << endl;
    cout << m1 << " " << m2 << endl;
}