def judge(ex,torf,i):

	if i==3:

		return eval(ex)

	else:

		return judge(ex,torf+[True],i+1) or judge(ex,torf+[False],i+1)

		

while 1:

	ex=input().split("|")

	if ex[0]=="#":break

	for j in range(len(ex)):

		dic=[]

		ex[j]=list(ex[j])[1:-1]

		for i in range(len(ex[j])):

			if ex[j][i]=="&":ex[j][i]="and"

			elif ex[j][i]=="~":ex[j][i]="not"

			else:

				if ex[j][i] not in dic:

					dic.append(ex[j][i])

					ex[j][i]="torf["+str(len(dic)-1)+"]"

				else:

					ex[j][i]="torf["+str(dic.index(ex[j][i]))+"]"

		ex[j]=" ".join(map(str,ex[j]))

	for clause in ex:

		if judge(clause,[],0):

			print("yes")

			break

	else:

		print("no")
while 1:

	exps=input().split("|")

	if exps[0]=="#":break

	for i in range(len(exps)):

		v=True

		lits=exps[i][1:-1].split("&")

		for lit1 in lits:

			for lit2 in lits:

				if (lit1=="~"+lit2) or ("~"+lit1==lit2):

					v=False

		if v:

			print("yes")

			break

	else:

		print("no")

		
def judge(ex, torf, i):
    if i == 3:
        return eval(ex)
    else:
        return judge(ex, torf + [True], i + 1) or judge(ex, torf + [False], i + 1)


while 1:
    ex = input().split("|")
    if ex[0] == "#":
        break
    for j in range(len(ex)):
        dic = []
        ex[j] = list(ex[j])[1:-1]
        for i in range(len(ex[j])):
            if ex[j][i] == "&":
                ex[j][i] = "and"
            elif ex[j][i] == "~":
                ex[j][i] = "not"
            else:
                if ex[j][i] not in dic:
                    dic.append(ex[j][i])
                    ex[j][i] = "torf[" + str(len(dic) - 1) + "]"
                else:
                    ex[j][i] = "torf[" + str(dic.index(ex[j][i])) + "]"
        ex[j] = " ".join(map(str, ex[j]))
    for clause in ex:
        if judge(clause, [], 0):
            print("yes")
            break
    else:
        print("no")

while 1:
    exps = input().split("|")
    if exps[0] == "#":
        break
    for i in range(len(exps)):
        v = True
        lits = exps[i][1:-1].split("&")
        for lit1 in lits:
            for lit2 in lits:
                if (lit1 == "~" + lit2) or ("~" + lit1 == lit2):
                    v = False
        if v:
            print("yes")
            break
    else:
        print("no")

-def judge(ex, torf, i): -    if i == 3: -        return eval(ex) -    else: -        return judge(ex, torf + [True], i + 1) or judge(ex, torf + [False], i + 1) - - -    ex = input().split("|") -    if ex[0] == "#": +    exps = input().split("|") +    if exps[0] == "#": -    for j in range(len(ex)): -        dic = [] -        ex[j] = list(ex[j])[1:-1] -        for i in range(len(ex[j])): -            if ex[j][i] == "&": -                ex[j][i] = "and" -            elif ex[j][i] == "~": -                ex[j][i] = "not" -            else: -                if ex[j][i] not in dic: -                    dic.append(ex[j][i]) -                    ex[j][i] = "torf[" + str(len(dic) - 1) + "]" -                else: -                    ex[j][i] = "torf[" + str(dic.index(ex[j][i])) + "]" -        ex[j] = " ".join(map(str, ex[j])) -    for clause in ex: -        if judge(clause, [], 0): +    for i in range(len(exps)): +        v = True +        lits = exps[i][1:-1].split("&") +        for lit1 in lits: +            for lit2 in lits: +                if (lit1 == "~" + lit2) or ("~" + lit1 == lit2): +                    v = False +        if v: