using System; class A { static string S; static void Main() { int[] cnt = new int[10]; int[] ans = { 20104,20063,19892,20011,19874,20199,19898,20163,19956,19841}; S = Console.ReadLine(); int[] e = new int[2]; for (int i = 0; i < 10; i++) { cnt[i] = Cnt(S, i); if (cnt[i] < ans[i]) { e[1] = i; } else if (cnt[i] > ans[i]) { e[0] = i; } } Console.WriteLine(e[0] + " " + e[1]); } static int Cnt(string s,int i) { int q = s.Length; string ss = s.Replace(i.ToString(), ""); return q - ss.Length; } }