#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int rev(int x) {
int xx = 0;
while(x) {
xx = xx*10+x%10;
x /= 10;
}
return xx;
}
int main() {
int mxx, mxy, w;
cin>>mxx>>mxy>>w;
map<double, int> cA, cB;
for(int a=1; a<=mxx; a++) {
int gcd = __gcd(a, rev(a));
cA[a/gcd*1.0/(rev(a)/gcd)]++;
}
cB[1] = 1;
int b = 1, x = -1, y = -1;
long long ans = cA[1], mn = LLONG_MAX;
for(int a=mxx; a>=1; a--) {
while(b<=mxy && ans<w) {
b++;
int gcd = __gcd(b, rev(b));
ans += cA[rev(b)/gcd*1.0/(b/gcd)];
cB[rev(b)/gcd*1.0/(b/gcd)]++;
}
if(b==mxy+1) break;
if(a*1LL*b<mn) mn = a*1LL*b, x = a, y = b;
int gcd = __gcd(a, rev(a));
ans -= cB[a/gcd*1.0/(rev(a)/gcd)];
cA[a/gcd*1.0/(rev(a)/gcd)]--;
}
if(x==-1) cout<<"-1\n";
else cout<<x<<" "<<y<<"\n";
return 0;
}/*1690966119.9241564*/
1613B - Absent Remainder | 1536B - Prinzessin der Verurteilung |
1699B - Almost Ternary Matrix | 1545A - AquaMoon and Strange Sort |
538B - Quasi Binary | 424A - Squats |
1703A - YES or YES | 494A - Treasure |
48B - Land Lot | 835A - Key races |
1622C - Set or Decrease | 1682A - Palindromic Indices |
903C - Boxes Packing | 887A - Div 64 |
755B - PolandBall and Game | 808B - Average Sleep Time |
1515E - Phoenix and Computers | 1552B - Running for Gold |
994A - Fingerprints | 1221C - Perfect Team |
1709C - Recover an RBS | 378A - Playing with Dice |
248B - Chilly Willy | 1709B - Also Try Minecraft |
1418A - Buying Torches | 131C - The World is a Theatre |
1696A - NIT orz | 1178D - Prime Graph |
1711D - Rain | 534A - Exam |