#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 /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char one[120];
  scanf("%s", one);
  int count, c2 = 0;
  for (count = 0; count < strlen(one); count++) {
    if (one[count] == 'H' || one[count] == 'Q' || one[count] == '9')
      break;
  }
  if (count == strlen(one))
    printf("NO");
  else
    printf("YES");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x80(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x88(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x8c(%rbp)
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x8c(%rbp),%eax
cmp    %ecx,%eax
jge    11e8 <main+0xb8>
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x48,%eax
je     11ca <main+0x9a>
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x51,%eax
je     11ca <main+0x9a>
movslq -0x84(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x39,%eax
jne    11cf <main+0x9f>
jmp    11e8 <main+0xb8>
jmp    11d4 <main+0xa4>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1166 <main+0x36>
mov    -0x84(%rbp),%eax
mov    %eax,-0x90(%rbp)
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x90(%rbp),%eax
cmp    %ecx,%eax
jne    121e <main+0xee>
lea    0xdef(%rip),%rdi
call   1040 <printf@plt>
jmp    122a <main+0xfa>
lea    0xde1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xebd(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %ebx,%ebx
test   %eax,%eax
jle    1196 <main+0x66>
mov    %rsp,%r14
mov    $0x1008001,%r15d
jmp    1183 <main+0x53>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1196 <main+0x66>
movzbl (%rsp,%rbx,1),%eax
add    $0xc7,%al
cmp    $0x18,%al
ja     1170 <main+0x40>
movzbl %al,%eax
bt     %rax,%r15
jae    1170 <main+0x40>
mov    %rsp,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebx
lea    0xe5c(%rip),%rax
lea    0xe58(%rip),%rdi
cmove  %rax,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"NO\00"
@.str.2 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca [120 x i8]
%2 = getelementptr inbounds [120 x i8], [120 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 @strlen(i8* %2)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %18
6: ; preds = %0, %10
%7 = phi i64 [ %11, %10 ], [ 0, %0 ]
%8 = getelementptr inbounds [120 x i8], [120 x i8]* %1, i64 0, i64 %7
%9 = load i8, i8* %8
switch i8 %9, label %10 [
i8 72, label %15
i8 81, label %15
i8 57, label %15
]
10: ; preds = %6
%11 = add nuw nsw i64 %7, 1
%12 = call i32 @strlen(i8* %2)
%13 = sext i32 %12 to i64
%14 = icmp slt i64 %11, %13
br i1 %14, label %6, label %15
15: ; preds = %6, %6, %6, %10
%16 = phi i64 [ %11, %10 ], [ %7, %6 ], [ %7, %6 ], [ %7, %6 ]
%17 = trunc i64 %16 to i32
br label %18
18: ; preds = %15, %0
%19 = phi i32 [ 0, %0 ], [ %17, %15 ]
%20 = call i32 @strlen(i8* %2)
%21 = icmp eq i32 %19, %20
%22 = select i1 %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%23 = call i32 @printf(i8* dereferenceable(1) %22)
ret i32 0
}