n = int(eval(input()))



result = sum(list(map(int, str(n))))



if result % 9 == 0:

    print('Yes')

else:

    print('No')
n = int(eval(input()))



if n % 9 == 0:

  print('Yes')

else:

  print('No')
n = int(eval(input()))
result = sum(list(map(int, str(n))))
if result % 9 == 0:
    print("Yes")
else:
    print("No")

n = int(eval(input()))
if n % 9 == 0:
    print("Yes")
else:
    print("No")

-result = sum(list(map(int, str(n)))) -if result % 9 == 0: +if n % 9 == 0: