#include <bits/stdc++.h>
using namespace std;
int main() {
  string dias[] = {"monday", "tuesday",  "wednesday", "thursday",
                   "friday", "saturday", "sunday"};
  string dia1, dia2;
  int m, n, x;
  getline(cin, dia1);
  getline(cin, dia2);
  for (int i = 0; i < 7; i++) {
    if (dias[i] == dia1) {
      m = i;
      break;
    }
  }
  for (int j = 0; j < 7; j++) {
    if (dias[j] == dia2) {
      n = j;
      break;
    }
  }
  x = (n - m + 7) % 7;
  if (x == 0 || x == 2 || x == 3)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
