#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 EOF;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int toupper(int);
int main() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  char buf[100001];
  int c, i, k = 0;
  while ((c = getchar()) != EOF) {
    if (c == toupper(c) && k == 1) {
      printf("No\n");
      exit(EXIT_SUCCESS);
    }
    if (c == toupper(c)) {
      k = 1;
      continue;
    }
    if (k == 0) {
      printf("No\n");
      exit(EXIT_SUCCESS);
    }
    k++;
    if (k > 4) {
      printf("No\n");
      exit(EXIT_SUCCESS);
    }
  }
  if (k == 1) {
    printf("No\n");
    exit(EXIT_SUCCESS);
  }
  printf("Yes\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e7f(%rip),%rax
mov    (%rax),%edx
lea    0xe8e(%rip),%rdi
lea    0xe91(%rip),%rsi
call   1050 <freopen@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edx
lea    0xe7e(%rip),%rdi
lea    0xe82(%rip),%rsi
call   1050 <freopen@plt>
movl   $0x0,-0x186bc(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x186b4(%rbp)
mov    0x2e28(%rip),%rcx
cmp    (%rcx),%eax
je     12a6 <main+0x156>
mov    -0x186b4(%rbp),%eax
mov    %eax,-0x186c0(%rbp)
mov    -0x186b4(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    -0x186c0(%rbp),%eax
cmp    %ecx,%eax
jne    120e <main+0xbe>
cmpl   $0x1,-0x186bc(%rbp)
jne    120e <main+0xbe>
lea    0xe1e(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x186b4(%rbp),%eax
mov    %eax,-0x186c4(%rbp)
mov    -0x186b4(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    -0x186c4(%rbp),%eax
cmp    %ecx,%eax
jne    1244 <main+0xf4>
movl   $0x1,-0x186bc(%rbp)
jmp    11a4 <main+0x54>
cmpl   $0x0,-0x186bc(%rbp)
jne    126b <main+0x11b>
lea    0xdc1(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x186bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x186bc(%rbp)
cmpl   $0x4,-0x186bc(%rbp)
jle    12a1 <main+0x151>
lea    0xd8b(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
jmp    11a4 <main+0x54>
cmpl   $0x1,-0x186bc(%rbp)
jne    12cd <main+0x17d>
lea    0xd5f(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d02(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
lea    0xd49(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x186d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
lea    0xe99(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1050 <freopen@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edx
lea    0xe89(%rip),%rdi
lea    0xe8d(%rip),%rsi
call   1050 <freopen@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e43(%rip),%r14
cmp    (%r14),%eax
je     11f2 <main+0xa2>
mov    %eax,%ebx
xor    %ebp,%ebp
jmp    11c1 <main+0x71>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebx
mov    %r15d,%ebp
cmp    (%r14),%eax
je     11ec <main+0x9c>
mov    %ebx,%edi
call   1030 <toupper@plt>
cmp    %eax,%ebx
jne    11d1 <main+0x81>
cmp    $0x1,%ebp
je     120b <main+0xbb>
mov    $0x1,%r15d
cmp    %eax,%ebx
je     11b0 <main+0x60>
test   %ebp,%ebp
je     120b <main+0xbb>
cmp    $0x3,%ebp
jg     120b <main+0xbb>
add    $0x1,%ebp
mov    %ebp,%r15d
jmp    11b0 <main+0x60>
cmp    $0x1,%r15d
je     120b <main+0xbb>
lea    0xe20(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe0b(%rip),%rdi
call   1040 <puts@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [11 x i8] c"output.txt\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
@EOF = global i32 0
@.str.4 = [4 x i8] c"No\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.5 = [5 x i8] c"Yes\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100001 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* @stdin
%7 = call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stdout
%9 = call i32 @freopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %8)
store i32 0, i32* %5
br label %10
10: ; preds = %48, %31, %0
%11 = call i32 (...) @getchar()
store i32 %11, i32* %3
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %49
14: ; preds = %10
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = call i32 @toupper(i32 %16)
%18 = icmp eq i32 %15, %17
br i1 %18, label %19, label %26
19: ; preds = %14
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%24 = load i32, i32* @EXIT_SUCCESS
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %19, %14
%27 = load i32, i32* %3
%28 = load i32, i32* %3
%29 = call i32 @toupper(i32 %28)
%30 = icmp eq i32 %27, %29
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 1, i32* %5
br label %10
32: ; preds = %26
%33 = load i32, i32* %5
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%37 = load i32, i32* @EXIT_SUCCESS
%38 = call i32 @exit(i32 %37)
unreachable
39: ; preds = %32
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
%42 = load i32, i32* %5
%43 = icmp sgt i32 %42, 4
br i1 %43, label %44, label %48
44: ; preds = %39
%45 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%46 = load i32, i32* @EXIT_SUCCESS
%47 = call i32 @exit(i32 %46)
unreachable
48: ; preds = %39
br label %10
49: ; preds = %10
%50 = load i32, i32* %5
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %56
52: ; preds = %49
%53 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%54 = load i32, i32* @EXIT_SUCCESS
%55 = call i32 @exit(i32 %54)
unreachable
56: ; preds = %49
%57 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input.txt\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [11 x i8] c"output.txt\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
@EOF = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [4 x i8] c"Yes\00"
@str.9 = [3 x i8] c"No\00"
define i32 @main() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @stdout
%4 = tail call i32 @freopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @getchar()
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %44, label %8
8: ; preds = %0, %29
%9 = phi i32 [ %31, %29 ], [ %5, %0 ]
%10 = phi i32 [ %30, %29 ], [ 0, %0 ]
%11 = tail call i32 @toupper(i32 %9)
%12 = icmp eq i32 %9, %11
%13 = icmp eq i32 %10, 1
%14 = select i1 %12, i1 %13, i1 false
br i1 %14, label %15, label %19
15: ; preds = %8
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.9, i64 0, i64 0))
%17 = load i32, i32* @EXIT_SUCCESS
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %8
br i1 %12, label %29, label %20
20: ; preds = %19
%21 = icmp eq i32 %10, 0
br i1 %21, label %22, label %26
22: ; preds = %20
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.9, i64 0, i64 0))
%24 = load i32, i32* @EXIT_SUCCESS
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %20
%27 = add nsw i32 %10, 1
%28 = icmp sgt i32 %10, 3
br i1 %28, label %34, label %29
29: ; preds = %26, %19
%30 = phi i32 [ %27, %26 ], [ 1, %19 ]
%31 = tail call i32 (...) @getchar()
%32 = load i32, i32* @EOF
%33 = icmp eq i32 %31, %32
br i1 %33, label %38, label %8
34: ; preds = %26
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.9, i64 0, i64 0))
%36 = load i32, i32* @EXIT_SUCCESS
%37 = tail call i32 @exit(i32 %36)
unreachable
38: ; preds = %29
%39 = icmp eq i32 %30, 1
br i1 %39, label %40, label %44
40: ; preds = %38
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.9, i64 0, i64 0))
%42 = load i32, i32* @EXIT_SUCCESS
%43 = tail call i32 @exit(i32 %42)
unreachable
44: ; preds = %0, %38
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}