python_code='
n=input();b=1
while b<n-2:
m=n;r=0;b+=1
while m/(r!=n):r=r*b+m%b;m/=b
'
for test_case in \
0 1 2 3 4 6 11 19 47 53 79 103 389 997 1459 \
5 7 8 9 10 13 16 43 48 61 62 101 113 211 1361
do
printf '%4d ' $test_case
if python -c "$python_code" <<< $test_case; then
echo true
else
echo false
fi
done 2>&-
cHl0aG9uX2NvZGU9JwoKbj1pbnB1dCgpO2I9MQp3aGlsZSBiPG4tMjoKIG09bjtyPTA7Yis9MQogd2hpbGUgbS8ociE9bik6cj1yKmIrbSViO20vPWIKCicKCmZvciB0ZXN0X2Nhc2UgaW4gXAoJMCAxIDIgMyAgNCAgNiAxMSAxOSA0NyA1MyA3OSAxMDMgMzg5IDk5NyAxNDU5IFwKCTUgNyA4IDkgMTAgMTMgMTYgNDMgNDggNjEgNjIgMTAxIDExMyAyMTEgMTM2MQoJZG8KCQlwcmludGYgJyU0ZCAnICR0ZXN0X2Nhc2UKCQlpZiBweXRob24gLWMgIiRweXRob25fY29kZSIgPDw8ICR0ZXN0X2Nhc2U7IHRoZW4KCQkJZWNobyB0cnVlCgkJZWxzZQoJCQllY2hvIGZhbHNlCgkJZmkKZG9uZSAyPiYt