require 'date'

class Today
  def initialize
    @wday = {0 => "Sunday", 1 => "Monday", 2 => "Tuesday", 3 => "Wednesday",
             4 => "Thursday", 5 => "Friday", 6 => "Saturday"}
    @dates = []
    @result = []
    while date = $stdin.gets.chomp.split(' ').map(&:to_i) do
      break if date[0] == 0 && date[1] == 0
      @result.push(Date.new(2004,date[0],date[1]).wday)
    end

    @result.each do |day|
      puts @wday[day]
    end
  end
end

t = Today.new