#include<bits/stdc++.h>
using namespace std;
int main() {
	int a;
	int b;
	int c;
	int d;
	for(int i=1000; i<=9999; ++i) {
		a=i/1000;
		b=i%1000/100;
		c=i%100/10;
		d=i%10;
		int reverse=d*1000+c*100+b*10+a;
		if(i*9==reverse) {
			printf("%d\n",i);
		}
	}
	return 0;
}