from datetime import datetime
try:
a = input()
b = input()
f = "%Y.%m.%d"
d1 = datetime.strptime(a, f)
d2 = datetime.strptime(b, f)
if d1 < d2:
raise Exception("Age cannot be negative.")
t = (d1 - d2).days
y = t // 365
d = t % 365
print(f"{y} years, {d} days.")
except ValueError as e:
print(f"Exception occurred: {e}")
except Exception as e:
print(e)