// Dupa sarcina, 0 de a si 0 de b tot conteaza
#include <iostream>
size_t nr_cifre(size_t n, const size_t a) {
size_t s = 0;
while (n) {
if (n % 10 == a)
++s;
n /= 10;
}
return s;
}
int main() {
size_t n, a, b;
std::cin >> n >> a >> b;
for (size_t i = 1; i <= n; ++i)
if (nr_cifre(i, a) == nr_cifre(i, b))
std::cout << i << ' ';
}