user_input=eval(input())

i=len(user_input)-1

number=0

while i>=0:

        number+=int(user_input[i])

        i=i-1

if number%9==0:

    print("Yes")

else :

    print("No")

x = eval(input(""))

for i in range(3):

    alist = list(map(int,x))

    result = sum(alist)

    x = str(result)

if result % 9 == 0 :

    print("Yes")

else:

    print("No")
user_input = eval(input())
i = len(user_input) - 1
number = 0
while i >= 0:
    number += int(user_input[i])
    i = i - 1
if number % 9 == 0:
    print("Yes")
else:
    print("No")

x = eval(input(""))
for i in range(3):
    alist = list(map(int, x))
    result = sum(alist)
    x = str(result)
if result % 9 == 0:
    print("Yes")
else:
    print("No")

-user_input = eval(input()) -i = len(user_input) - 1 -number = 0 -while i >= 0: -    number += int(user_input[i]) -    i = i - 1 -if number % 9 == 0: +x = eval(input("")) +for i in range(3): +    alist = list(map(int, x)) +    result = sum(alist) +    x = str(result) +if result % 9 == 0: