#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265359;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  string s1[7] = {"monday", "tuesday",  "wednesday", "thursday",
                  "friday", "saturday", "sunday"};
  string s, t;
  cin >> s >> t;
  int x, y, i;
  for (i = 0; i < 7; i++) {
    if (s1[i] == s) x = i + 1;
    if (s1[i] == t) y = i + 1;
  }
  if (x > y) y += 7;
  if (-(x - y) == 0 || -(x - y) == 3 || -(x - y) == 2)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
