Олимпиадный тренинг

Задача 23370. Again deuce (B, B')


Задача

Темы:
Petya likes the number 2. He considers a number beautiful if its decimal notation has exactly two digits 2. Petya wants to get a big list of beautiful numbers and hang it on the wall.
Help Petya and print all beautiful numbers not exceeding n.
 
Input data format
The first and only line contains a single integer n (1 <= n <= 106).
 
Output format
Print all positive integers not exceeding n whose decimal notation contains exactly two digits 2.  Numbers should be printed in ascending order, one per line.

Enter Output
179 22
122
1  

Remark
Note that the list can be empty, in which case nothing needs to be displayed.