#include <iostream>
using namespace std;

char date[7][10] =
{
  "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday"
};

int lm[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
  int m,d;
  while(cin >> m >> d, m+d){
    int ld = 0;
    for(int i=0; i<m-1; i++){
      ld += lm[i];
    }
    ld += d;
    cout << ld << endl;
    cout << date[ld%7+2] << endl;
  }
  
  return 0;
}