#include <stdio.h>

int tonggou(int num) {
	int square = num * num;
	int i = 10;
	
	while(i <= 1000) {
		if(num == square % i) return 1;
		i *= 10;
	}
	
	return 0;
}

int main() {
	int a,b;
	scanf("%d %d",&a,&b);
	
	while(a <= b) {
		if(tonggou(a)) printf("%d\n",a);
		a++;
	}
	
	return 0;
}