import datetime y,m,d=map(int,raw_input().strip().split()) t = datetime.datetime(y,m,d) d = t + datetime.timedelta(days = +1) print d.year,d.month,d.day