#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1;
  string s2;
  cin >> s1 >> s2;
  int a, b;
  if (s1[0] == 'm')
    a = 1;
  else if (s1[0] == 't' && s1[1] == 'u')
    a = 2;
  else if (s1[0] == 'w')
    a = 3;
  else if (s1[0] == 't' && s1[1] == 'h')
    a = 4;
  else if (s1[0] == 'f')
    a = 5;
  else if (s1[0] == 's' && s1[1] == 'a')
    a = 6;
  else if (s1[0] == 's' && s1[1] == 'u')
    a = 7;
  if (s2[0] == 'm')
    b = 1;
  else if (s2[0] == 't' && s2[1] == 'u')
    b = 2;
  else if (s2[0] == 'w')
    b = 3;
  else if (s2[0] == 't' && s2[1] == 'h')
    b = 4;
  else if (s2[0] == 'f')
    b = 5;
  else if (s2[0] == 's' && s2[1] == 'a')
    b = 6;
  else if (s2[0] == 's' && s2[1] == 'u')
    b = 7;
  int c = b - a;
  if (c < 0) c += 7;
  if ((31 - c) % 7 == 0 || (30 - c) % 7 == 0 || (28 - c) % 7 == 0)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
