import datetime a,b,c=map(int,raw_input().strip().split()) d = datetime.date( a ,b ,c ) d = d + datetime.timedelta(days = 1) print d.year,d.month,d.day