A,B=map(int,input().split()) if A==B:print(10-B,B-10+B) else:print(10-A,B-10+A)