#include #include using namespace std; int a[10] = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841}; int main() { string S; cin >> S; for (int i = 0; i < S.length(); i++) if (i != 1) a[S[i] - '0']--; int x, y; for (int k = 0; k < 10; k++) { if (a[k] == -1) x = k; if (a[k] == 1) y = k; } cout << x << ' ' << y << endl; }