#include #include #include #include using namespace std; int a[10] = { 1954, 1997, 1986, 1986, 2043, 2082, 2017, 1953, 1962, 2020 }; int b[10]; int main() { char c1,c2; cin >> c1; cin >> c2; for (int i = 0; i < 20000; i++) { char ch; cin >> ch; b[ch - '0']++; } int g = 0; int l = 0; for (int i = 0; i < 10; i++) { if (a[i] < b[i]) { l = i; } if (a[i] > b[i]) { g = i; } } if (l != g) { cout << g << " " << l << endl; } else { cout << c1 << " " << 3 << endl; } return 0; }