a=[20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841] b=[0 for i in range(10)] # b=[20104, 20063, 19893, 20011, 19874, 20198, 19898, 20163, 19956, 19841] pi=raw_input() b[int(pi[0])]+=1 for i in pi[2:]: b[int(i)]+=1 w=0 r=0 for i in range(10): if a[i]b[i]: r=i print w,r