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