#include <bits/stdc++.h>
int Get(int a, int b, char c) {
  if (c == '&') return a & b;
  if (c == '|') return a | b;
  return a ^ b;
}
int Calc() {
  int i, j, l, r, res = 0;
  char ch = getchar();
  if (ch == '?') return 6;
  if (ch == '0') return 1;
  if (ch == '1') return 8;
  l = Calc(), ch = getchar(), r = Calc(), getchar();
  for (i = 0; i < 4; ++i)
    if (l & (1 << i))
      for (j = 0; j < 4; ++j)
        if (r & (1 << j)) res |= 1 << Get(i, j, ch);
  return res;
}
int main() {
  scanf("%*d"), getchar();
  if (Calc() & 6)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
