#include <bits/stdc++.h>
using namespace std;
const string days[] = {"monday", "tuesday",  "wednesday", "thursday",
                       "friday", "saturday", "sunday"};
int dist, a, b;
string s, d;
int main() {
  cin >> s >> d;
  a = find(days, days + 7, s) - days;
  b = find(days, days + 7, d) - days;
  dist = b - a;
  if (dist < 0) dist += 7;
  if (dist == 0 || dist == 2 || dist == 3) return cout << "YES\n", false;
  return cout << "NO\n", false;
}
