#include<bits/stdc++.h>
using namespace std;
bool huiwen(string s){
for(int i=0,j=s.length( )-1;i<j;i++,j--)if(s[i]!=s[j])return false;
return true;
}
int main( ){
int n,m;cin>>n>>m;
for(int x=pow(10,n-1);x<pow(10,n);x++){
for(int y=pow(10,m-1);y<pow(10,m);y++){
int z=x*y;
stringstream szzzfc;
szzzfc<<z;
string s;
szzzfc>>s;
if(huiwen(s)){
cout<<x<<" "<<y<<endl;
return 0;
}
}
}
return 0;
}