import calendar
import time
import datetime
while True:
time = map(int,raw_input().strip().split())
today = datetime.date(day=time[2], month=time[1], year=time[0])
tomorrow = today + datetime.timedelta(days=1)
print str(tomorrow.year)+" "+str(tomorrow.month)+" "+str(tomorrow.day)