import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IllegalArgumentException {
Scanner sc = new Scanner(System.in);
int month = sc.nextInt();
int day = sc.nextInt();
String[] week = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
int[] daysInMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if (day > daysInMonth[month - 1]) {
throw new IllegalArgumentException();
}
int prevMonth = month - 1;
for (int i = 0; i < prevMonth; i ++) {
day += daysInMonth[i];
}
System.out.print(week[(day-1)%7]);
}
}