#include #define ll long long #define INF 1000000005 #define MOD 1000000007 #define EPS 1e-10 #define rep(i,n) for(int i=0;i<(int)n;++i) #define each(a, b) for(auto (a): (b)) #define all(v) (v).begin(),(v).end() #define fi first #define se second #define pb push_back #define show(x) cout <<#x<<" = "<<(x)<P; const int MAX_N = 100005; int main() { string s; cin >> s; vector vec = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841}; vector hoge(10,0); rep(i,s.size()){ if(i != 1){ hoge[(int)(s[i]-'0')]++; } } int pre,pos; rep(i,10){ if(vec[i] < hoge[i]){ pre = i; }else if(vec[i] > hoge[i]){ pos = i; } } cout << pre << " " << pos << "\n"; return 0; }