#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[12] = {0, 3, 3, 6, 1, 4, 0, 2, 5, 0, 3}, i, j, f;
  string s;
  cin >> s;
  switch (s[0]) {
    case 's':
      if (s[1] == 'u')
        i = 0;
      else
        i = 6;
      break;
    case 'm':
      i = 1;
      break;
    case 't':
      if (s[1] == 'u')
        i = 2;
      else
        i = 4;
      break;
    case 'w':
      i = 3;
      break;
    case 'f':
      i = 5;
  }
  cin >> s;
  switch (s[0]) {
    case 's':
      if (s[1] == 'u')
        j = 0;
      else
        j = 6;
      break;
    case 'm':
      j = 1;
      break;
    case 't':
      if (s[1] == 'u')
        j = 2;
      else
        j = 4;
      break;
    case 'w':
      j = 3;
      break;
    case 'f':
      j = 5;
  }
  if (i <= j)
    j = j - i;
  else
    j = 7 + j - i;
  f = 0;
  for (i = 1; i < 12 && !f; i++)
    if (a[i] - a[i - 1] == j) f = 1;
  if (f)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
