#include<iostream>

using namespace std;


int Reverse(int n){
	int fir = n % 10;    //个位
	int sec = n / 10 % 10;  //十位
	int thir = n / 100 % 10;    //百位
	int fourth = n / 1000;    //千位
	return fir * 1000 + sec * 100 + thir * 10 + fourth;
}


int main(){
	for(int i = 1000; i <= 9999; ++i){
		if(i * 9 == Reverse(i)){
			printf("%d\n",i);
		}
	}
	return 0;
}