object Main extends App {
  val src: Iterator[List[Int]] = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt).toList)

  val daysList: List[Int] = List(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)

  def figureDay(months: Int, days: Int): String = {
    val dayReminder:Int = (daysList.take(months-1).sum + days) % 7
    if (dayReminder == 5) "Tuesday"
    else if (dayReminder == 6) "Wednesday"
    else if (dayReminder == 1) "Thursday"
    else if (dayReminder == 2) "Friday"
    else if (dayReminder == 3) "Saturday"
    else if (dayReminder == 4) "Sunday"
    else "Monday"
  }

  for (li <- src if li != List(0, 0))
    {
      val List(months, days) = li
      println(figureDay(months, days))
    }

}