#include using namespace std; int c[20]={20104,20063,19892,20011,19874,20199,19898,20163,19956,19841},d[20]; int main(){ for(int i=0,a;i<=200001;++i) d[((a=getchar()-'0')!='.')>=0?a:10]++; for(int i=0;i<=9;++i) if(d[i]>c[i]) putchar(i+'0'); printf(" "); for(int i=0;i<=9;++i) if(c[i]>d[i]) putchar(i+'0'); return 0; }