#include "bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; using P = pair; constexpr ld EPS = 1e-12; constexpr int INF = numeric_limits::max() / 2; constexpr int MOD = 1e9 + 7; int cnt[10] = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841}; int main() { cin.tie(0); ios::sync_with_stdio(false); vector cnts(10, 0); string s; cin >> s; for (int i = 0; i < (int)s.length(); i++) { if (s[i] != '.') { cnts[s[i] - '0']++; } } int p, q; for (int i = 0; i < 10; i++) { if (cnts[i] > cnt[i]) p = i; if (cnts[i] < cnt[i]) q = i; } cout << p << " " << q << endl; }