#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
using namespace std;
int min_4(int a,int b,int c,int d)
{
a=a<b?a:b;
a=a<c?a:c;
a=a<d?a:d;
return a;
}
string work(int x)
{
string s="th";
const string ss[]={"st","nd","rd"};
int t=x%;
if(t==&&x%!=)s=ss[];
else if(t==&&x%!=)s=ss[];
else if(t==&&x%!=)s=ss[];
return s;
}
int main()
{
//freopen("acm.acm","r",stdin);
int n,len,i,t,m;
len=;
int a[],x2=,x3=,x5=,x7=;
a[]=;
while(len <= )
{
m=min_4(a[x2]*,a[x3]*,a[x5]*,a[x7]*);
if(m==a[x2]*)x2++;
if(m==a[x3]*)x3++;
if(m==a[x5]*)x5++;
if(m==a[x7]*)x7++;
a[len++]=m;
}
while(scanf("%d",&n))
{
if(!n)
break;
string s=work(n);
printf("The ");
printf("%d",n);
printf("%s",s.c_str());
printf(" humble number is ");
printf("%d",a[n-]);
printf(".\n");
}
return ;
}