#include <bits/stdc++.h>
using namespace std;
int n;
int Work() {
  char c;
  scanf("%c", &c);
  if (c == '0')
    return 1;
  else if (c == '1')
    return 8;
  else if (c == '?')
    return 6;
  int tmp1 = Work();
  scanf("%c", &c);
  int tmp2 = Work(), ans = 0;
  for (int i = 0; i < 4; i++)
    if (tmp1 & (1 << i))
      for (int j = 0; j < 4; j++)
        if (tmp2 & (1 << j))
          if (c == '|')
            ans |= 1 << (i | j);
          else if (c == '&')
            ans |= 1 << (i & j);
          else
            ans |= 1 << (i ^ j);
  getchar();
  return ans;
}
int main() {
  scanf("%d ", &n);
  if (Work() & 6)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
