N = input() X = N.replace('7', '6') print(X, int(N)-int(X))