
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <map>
#include <string>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int pos;
char str[10000];

string GetVariable() {
  string ret = "";
  assert(isalpha(str[pos]));
  while (isalpha(str[pos])) {
    ret += str[pos];
    pos++;
  }
  return ret;
}

int main() {
  while (scanf("%s", str), str[0] != '#') {
    pos = 0;
    while (str[pos] != '\0') {
      if (str[pos] == '|') { pos++; }
      assert(str[pos] == '(');
      pos++;
      map<string, int> use;
      int ok = 1;
      while (str[pos] != ')') {
        int v = 1;
        if (str[pos] == '~') { pos++; v ^= 1; }
        string s = GetVariable();
        if (str[pos] == '&') { pos++; }
        if (use.count(s)) {
          if (use[s] != v) {
            use[s] = -1;
            ok = 0;
          }
        } else {
          use[s] = v;
        }
      }
      pos++;
      if (ok) {
        puts("yes");
        goto next;
      }
    }
    puts("no");
next:;
  }
}