let find_id p array =
  let n = Array.length array in
  let rec iter i =
    if i = n
    then raise Not_found
    else
      if p array.(i)
      then i
      else iter (i+1)
  in iter 0

let () = Scanf.scanf "%s" @@ fun s ->
  let array = [|"SUN"; "MON"; "TUE"; "WED"; "THU"; "FRI"; "SAT"|] in
  let id = find_id (fun elt -> elt = s) array in
  Printf.printf "%s\n" @@ array.((id+1) mod 7)