#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int getnum(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char day[10];
  int f, s, i = 0, sub = 0;
  int data[12] = {3, 0, 3, 2, 3, 2, 3, 3, 2, 3, 2, 3};
  char can = 0;
  scanf("%s", day);
  f = getnum(day);
  scanf("%s", day);
  s = getnum(day);
  sub = s - f;
  if (sub < 0) {
    sub = 7 + sub;
  }
  for (i = 0; i < 12; i++) {
    if (sub == data[i]) {
      can = 1;
    }
  }
  printf("%s", can ? "YES" : "NO");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe98(%rip),%rsi
mov    $0x30,%edx
call   1050 <memcpy@plt>
movb   $0x0,-0x51(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1060 <scanf@plt>
lea    -0xe(%rbp),%rdi
call   1030 <getnum@plt>
mov    %eax,-0x14(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1060 <scanf@plt>
lea    -0xe(%rbp),%rdi
call   1030 <getnum@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    11ca <main+0x8a>
mov    -0x20(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xc,-0x1c(%rbp)
jge    1203 <main+0xc3>
mov    -0x20(%rbp),%eax
movslq -0x1c(%rbp),%rcx
cmp    -0x50(%rbp,%rcx,4),%eax
jne    11f0 <main+0xb0>
movb   $0x1,-0x51(%rbp)
jmp    11f5 <main+0xb5>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d1 <main+0x91>
movsbl -0x51(%rbp),%ecx
lea    0xe29(%rip),%rsi
lea    0xe1e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe0d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%r14
lea    0x6(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <getnum@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <getnum@plt>
sub    %ebp,%eax
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
mov    %ecx,%eax
and    $0xfffffffe,%eax
test   $0xfffffffd,%ecx
lea    0xe7b(%rip),%rdx
lea    0xe78(%rip),%rsi
cmove  %rdx,%rsi
cmp    $0x3,%ecx
cmove  %rdx,%rsi
cmp    $0x2,%eax
cmove  %rdx,%rsi
cmp    $0x3,%ecx
cmove  %rdx,%rsi
cmp    $0x2,%eax
cmove  %rdx,%rsi
cmp    $0x2,%ecx
cmove  %rdx,%rsi
cmp    $0x3,%ecx
cmove  %rdx,%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.data = [12 x i32] [i32 3, i32 0, i32 3, i32 2, i32 3, i32 2, i32 3, i32 3, i32 2, i32 3, i32 2, i32 3]
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"YES\00"
@.str.2 = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [12 x i32]
%8 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
%9 = bitcast [12 x i32]* %7 to i8*
store i8 0, i8* %8
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%13 = call i32 @getnum(i8* %12)
store i32 %13, i32* %3
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%17 = call i32 @getnum(i8* %16)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = sub nsw i32 %18, %19
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %0
%24 = load i32, i32* %6
%25 = add nsw i32 7, %24
store i32 %25, i32* %6
br label %26
26: ; preds = %23, %0
store i32 0, i32* %5
br label %27
27: ; preds = %39, %26
%28 = load i32, i32* %5
%29 = icmp slt i32 %28, 12
br i1 %29, label %30, label %42
30: ; preds = %27
%31 = load i32, i32* %6
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [12 x i32], [12 x i32]* %7, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = icmp eq i32 %31, %35
br i1 %36, label %37, label %38
37: ; preds = %30
store i8 1, i8* %8
br label %38
38: ; preds = %37, %30
br label %39
39: ; preds = %38
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %27
42: ; preds = %27
%43 = load i8, i8* %8
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 0
%46 = zext i1 %45 to i64
%47 = select i1 %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %47)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"YES\00"
@.str.2 = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @getnum(i8* %2)
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%6 = call i32 @getnum(i8* %2)
%7 = sub nsw i32 %6, %4
%8 = icmp slt i32 %7, 0
%9 = add nsw i32 %7, 7
%10 = select i1 %8, i32 %9, i32 %7
%11 = icmp eq i32 %10, 3
%12 = icmp eq i32 %10, 2
%13 = and i32 %10, -3
%14 = icmp eq i32 %13, 0
%15 = or i1 %11, %14
%16 = and i32 %10, -2
%17 = icmp eq i32 %16, 2
%18 = or i1 %11, %17
%19 = and i32 %10, -2
%20 = icmp eq i32 %19, 2
%21 = or i1 %12, %20
%22 = select i1 %11, i1 true, i1 %21
%23 = select i1 %22, i1 true, i1 %18
%24 = select i1 %23, i1 true, i1 %15
%25 = select i1 %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %25)
ret i32 0
}