# coding:utf-8 A, B = input().split() A1 = list(A) B1 = list(B) a = [0]*14 b = [0]*14 for i in range(len(A1)): a[13-i]=int(A1[-1-i]) for i in range(len(B1)): b[13-i]=int(B1[-1-i]) for i in range(14): if a[i]==b[i]: continue elif a[i]==4 and b[i]==7: print('a',A) break elif a[i]==7 and b[i]==4: print(B) break elif a[i]>b[i]: print(A) break elif a[i]