#include <bits/stdc++.h>
using namespace std;
inline int calc(int x, int y, char c) {
  if (c == '&') return x & y;
  if (c == '|') return x | y;
  return x ^ y;
}
int work() {
  char c;
  scanf("%c", &c);
  if (c == '(') {
    int l = work();
    char op;
    scanf("%c", &op);
    int r = work(), res = 0;
    scanf("%*c");
    for (int i = 0; i < 4; i++) {
      if (!(l & (1 << i))) continue;
      for (int j = 0; j < 4; j++) {
        if (!(r & (1 << j))) continue;
        res |= 1 << calc(i, j, op);
      }
    }
    return res;
  }
  if (c == '?') return 6;
  return c == '0' ? 1 : 8;
}
int main() {
  scanf("%*d\n");
  puts(work() & 6 ? "YES" : "NO");
  return 0;
}
