import java.util.*;publicclassMain{static Set<String> set =newTreeSet<String>();publicstaticbooleanisLeapYear(int year){return year%400==0||( year%4==0&& year%100!=0);}publicstaticvoidcheck(int a,int b ,int c){if(a>=60&& a<=99) a +=1900;elseif(a>=0&& a<=59) a +=2000;elsereturn;if(b>12||b<=0)return;if(c>31||c<=0)return;switch(b){case4:case6:case9:case11:if(c>30)return;break;case2:if(isLeapYear(a)){if(c>29)return;}else{if(c>28)return;}}
set.add(a+"-"+(b<10?"0"+b:b)+"-"+(c<10?"0"+c:c));}publicstaticvoidmain(String[] args){// TODO Auto-generated method stub
Scanner in =newScanner(System.in);
String s = in.next();int a =(s.charAt(0)-'0')*10+s.charAt(1)-'0';int b =(s.charAt(3)-'0')*10+s.charAt(4)-'0';int c =(s.charAt(6)-'0')*10+s.charAt(7)-'0';check(a, b, c);check(c, a, b);check(c, b, a);for(String str:set){
System.out.println(str);}}}