import time import datetime a,b,c=list(map(int,input().split())) now=datetime.date(a,b,c) delta=datetime.timedelta(days=1) n_days=now+delta n=list(n_days.strftime('%Y %m %d').split()) print(n[0],int(n[1]),int(n[2]))