Problem:
Day of Week

The 9th day of September 2017 is Saturday. Then, what day of the week is the X-th of September 2017?

Given a day in September 2017, write a program to report what day of the week it is.

Input

The input is given in the following format.

X

The input line specifies a day X (1 ≤ X ≤ 30) in September 2017.

Output

Output what day of the week it is in a line. Use the following conventions in your output: "mon" for Monday, "tue" for Tuesday, "wed" for Wednesday, "thu" for Thursday, "fri" for Friday, "sat" for Saturday, and "sun" for Sunday.

Sample Input 1

1

Sample Output 1

fri

Sample Input 2

9

Sample Output 2

sat

Sample Input 3

30

Sample Output 3

sat

Solution in JAVA (judge verdict: Accepted)

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

class Main{
	public static void main(String[] args) {
		List<String> youbi =
				new ArrayList<String>(Arrays.asList("mon","tue","wed","thu","fri","sat","sun"));
		int[] hi=new int[30];
		for(int i=0; i<30; i++) {
			hi[i]=(4+i)%7;
		}
		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
		String str="";
		int aa=0;
		while(true) {
			try {
				str=bfr.readLine();
				if(str==null) {
					System.exit(0);
				}
				aa=Integer.parseInt(str);
				
				if(aa>=31) {
					System.exit(0);
				}
				System.out.println(youbi.get((hi[aa-1])));
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}