#include <bits/stdc++.h>
using namespace std;
char s1[20], s2[20];
int a1, a2;
int look(char *s) {
  if (s[0] == 'm') return 1;
  if (s[1] == 'h') return 4;
  if (s[0] == 't') return 2;
  if (s[0] == 'w') return 3;
  if (s[0] == 'f') return 5;
  if (s[1] == 'a') return 6;
  if (s[0] == 's') return 7;
}
int main() {
  scanf("%s%s", &s1, &s2);
  a1 = look(s1), a2 = look(s2);
  int c = (a2 - a1 + 7) % 7;
  cout << ((c == 0 || c == 2 || c == 3) ? "YES" : "NO") << endl;
  return 0;
}
