a={1} i=999 while i:a|={int('123456789'[i%9:i%10:i%7+1]or 1)};i-=1 for i in sorted(a)[9:]:print i