#include <iostream>
using namespace std;

bool is_leap_year(int year) {
	if(year%100 == 0 && year%400 != 0)
		return false;

	if(year%4 != 0)
		return false;

	return true;
}

int step_1(int year) {
	int century = (int)(year/100)+1;

	switch(century%4) {
		case 0: return 0;
		case 1: return 6;
		case 2: return 4;
		case 3: return 2;

		default: return -1;
	}
}

int step_2(int year, int month) {
	if(!is_leap_year(year)) {
		int last_leap_year = year;
		while(!is_leap_year(last_leap_year))
			last_leap_year--;

		return ((int)((last_leap_year%100)/4)*5+(year-last_leap_year)+1);
	}

	else {
		int temp = ((int)((year%100)/4)*5);
		if(month > 2)
			return temp+1;
		return temp;
	}
}

int step_3(int month, int date) {
	switch(month) {
		case 1: return date;
		case 2: return 3+date;
		case 3: return 3+date;
		case 4: return 6+date;
		case 5: return 1+date;
		case 6: return 4+date;
		case 7: return 6+date;
		case 8: return 2+date;
		case 9: return 5+date;
		case 10:return date;
		case 11:return 3+date;
		case 12:return 5+date;

		default: return -1;
	}
}


int main() {
	int date, month, year;
	int day = 0;

	cin >> date >> month >> year;


	day += step_1(year);
	day += step_2(year, month);
	day += step_3(month, date);
	day = day % 7;

	switch(day) {
		case 1: cout << "Sunday." << endl; break;
		case 2: cout << "Monday." << endl; break;
		case 3: cout << "Tuesday." << endl; break;
		case 4: cout << "Wednesday." << endl; break;
		case 5: cout << "Thursday." << endl; break;
		case 6: cout << "Friday." << endl; break;
		case 0: cout << "Saturday." << endl; break;

		default: cout << "Error." << endl; break;
	}

	return 0;
}