#include <bits/stdc++.h>
int f(int a, int b, int c) {
  if (c == '&') return a & b;
  if (c == '|') return a | b;
  return a ^ b;
}
int calc() {
  int i, j, c, l, o, r, ret = 0;
  c = getchar();
  if (c == '0') return 1;
  if (c == '1') return 8;
  if (c == '?') return 6;
  l = calc();
  o = getchar();
  r = calc();
  getchar();
  for (i = 0; i < 4; i++)
    if (l & (1 << i))
      for (j = 0; j < 4; j++)
        if (r & (1 << j)) ret |= 1 << f(i, j, o);
  return ret;
}
int main() {
  scanf("%*d"), getchar();
  puts(calc() & 6 ? "YES" : "NO");
  return 0;
}
