import java.util.Calendar;
public class Calendar0 {
public static void main(String[]args){
Calendar cal = Calendar.getInstance();
int year=cal.get(Calendar.YEAR);//目前是哪一年
int month=cal.get(Calendar.MONTH);//目前是哪一月
int day=cal.get(Calendar.DAY_OF_MONTH);//今天是哪天
int week=cal.get(Calendar.DAY_OF_WEEK)-1;//今天星期几,周一是1,周日是0
int week0=(week-day%7+1)%7;//这个月的一号是星期几
int[] Month={31,28,31,30,31,30,31,31,30,31,30,31};//一年当中的每个月的数目
int count=0;
System.out.println(year+"年"+(month+1)+"月"+day+"日");
System.out.println("Sun "+"Mon "+"Tue "+"Wed "+"Thu "+"Fri "+"Sat ");
while(week0!=0){
System.out.print(" ");
week0--;count++;
}
if((year%400==0)||(year%4==0&&year%100!=0))
Month[1]=29;
for(int i=0;i<Month[month];i++){
System.out.print((i+1)+" ");
count++;
if(count%7==0)
System.out.println();
}
}
}