#include <bits/stdc++.h>
using namespace std;
int solve(char s[]) {
  if (s[0] == 'm')
    return 1;
  else if (s[0] == 't' && s[1] == 'u')
    return 2;
  else if (s[0] == 'w')
    return 3;
  else if (s[0] == 't' && s[1] == 'h')
    return 4;
  else if (s[0] == 'f')
    return 5;
  else if (s[0] == 's' && s[1] == 'a')
    return 6;
  else if (s[0] == 's' && s[1] == 'u')
    return 7;
  else
    return 0;
}
int main() {
  char s1[10], s2[10];
  int res1, res2;
  while (scanf("%s\n%s", s1, s2) != EOF) {
    res1 = solve(s1);
    res2 = solve(s2);
    if (res2 >= res1) {
      if (abs(res1 - res2) == 0 || abs(res1 - res2) == 2 ||
          abs(res1 - res2) == 3) {
        printf("YES\n");
      } else
        printf("NO\n");
    } else {
      if (7 - res1 + res2 == 2 || 7 - res1 + res2 == 3) {
        printf("YES\n");
      } else
        printf("NO\n");
    }
  }
  return 0;
}
