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