#include <bits/stdc++.h>
using namespace std;
map<string, int> a;
string s, t;
int main() {
  a["monday"] = 1;
  a["tuesday"] = 2;
  a["wednesday"] = 3;
  a["thursday"] = 4;
  a["friday"] = 5;
  a["saturday"] = 6;
  a["sunday"] = 7;
  cin >> s >> t;
  int x = (a[t] - a[s] + 7) % 7;
  if (x == 3 || x == 2 || x == 0)
    cout << "YES\n";
  else
    cout << "NO\n";
}
