#include <cstdio>
#include <cassert>
#include <cctype>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>

enum Closure {
  A = 1<<0,
  NOT_A = 1<<1,
  B = 1<<2,
  NOT_B = 1<<3,
  OP_OR = 1<<4,
  OP_AND = 1<<5,

  ANY_A = (A|NOT_A),
  ANY_B = (B|NOT_B),
  ANY_OP = (OP_OR|OP_AND),
  ALL_BITS = (ANY_A|ANY_B|ANY_OP),
};

inline Closure operator ~(Closure x) {
  if (!(x & ANY_OP))
    return static_cast<Closure>(x<<1);
  return static_cast<Closure>(x^ALL_BITS);
}

Closure apply(Closure lhs, char op, Closure rhs) {
  if (op == '&') {
    return static_cast<Closure>(lhs|OP_AND|rhs);
  } else if (op == '|') {
    return static_cast<Closure>(lhs|OP_OR|rhs);
  }
  assert(false);
}

Closure parse_literal(const std::string &s, size_t &i) {
  char ch=s[i++];
  if (ch == '1') return A;
  if (ch == '2') return B;
  assert(false);
}

Closure parse(const std::string &s, size_t &i,
              const std::vector<std::string> &ops={"|&", ""}, size_t preced=0) {

  if (ops[preced].empty()) {
    if (s[i] == '(') {
      Closure tmp=parse(s, ++i, ops, 0);
      assert(s[i] == ')');
      ++i;
      return tmp;
    } else if (s[i] == '~') {
      return ~parse(s, ++i, ops, preced);
    }
    return parse_literal(s, i);
  }

  Closure res=parse(s, i, ops, preced+1);
  while (i < s.length()) {
    char op=s[i];
    if (!std::count(ops[preced].begin(), ops[preced].end(), op)) break;
    Closure tmp=parse(s, ++i, ops, preced+1);
    res = apply(res, op, tmp);
  }
  return res;
}

std::vector<std::string> preprocess(const std::string &s, std::string &t) {
  std::vector<std::string> lits;
  t.clear();
  for (size_t i=0; i<s.length(); ++i) {
    if (isalpha(s[i])) {
      std::string cur(1, s[i]);
      while (++i < s.length() && isalpha(s[i])) {
        cur += s[i];
      }
      lits.emplace_back(std::move(cur));
      t += lits.size() + '0';
    }
    if (i < s.length())
      t += s[i];
  }
  assert(t.back() == ';');
  t.pop_back();
  return lits;
}

template <class Weight>
struct Edge {
  size_t src, dst;
  Weight cost;

  Edge(size_t src, size_t dst, Weight cost=1):
    src(src), dst(dst), cost(cost)
  {}

  bool operator <(const Edge<Weight> &rhs) const {
    if (cost != rhs.cost) return cost < rhs.cost;
    if (src != rhs.src) return src < rhs.src;
    return dst < rhs.dst;
  }
};

template <class Weight>
struct Graph: public std::vector<std::vector<Edge<Weight>>> {
  Graph(size_t n): std::vector<std::vector<Edge<Weight>>>(n) {}

  void connect_with(size_t src, size_t dst, Weight cost=1) {
    (*this)[src].emplace_back(src, dst, cost);
    (*this)[dst].emplace_bacl(dst, src, cost);
  }

  void connect_to(size_t src, size_t dst, Weight cost=1) {
    (*this)[src].emplace_back(src, dst, cost);
  }

  std::vector<size_t> sccomp(size_t &num) const {
    const size_t V=this->size();
    Graph rev(V);
    for (const auto &v: *this)
      for (const auto &e: v)
        rev.connect_to(e.dst, e.src, e.cost);

    std::vector<bool> used(V);
    std::vector<size_t> vs;
    std::function<void (size_t)> dfs=[&](size_t v) {
      used[v] = true;
      for (size_t i=0; i<(*this)[v].size(); ++i)
        if (!used[(*this)[v][i].dst]) dfs((*this)[v][i].dst);

      vs.push_back(v);
    };

    for (size_t v=0; v<V; ++v)
      if (!used[v]) dfs(v);

    used.assign(V, false);
    std::vector<size_t> cmp(V);
    num = 0;
    std::function<void (size_t)> rdfs=[&](size_t v) {
      used[v] = true;
      cmp[v] = num;
      for (size_t i=0; i<rev[v].size(); ++i)
        if (!used[rev[v][i].dst]) rdfs(rev[v][i].dst);
    };

    for (size_t i=vs.size(); i--;)
      if (!used[vs[i]]) {
        rdfs(vs[i]);
        ++num;
      }

    return cmp;
  }

  std::vector<size_t> sccomp() const {
    size_t tmp;
    return sccomp(tmp);
  }
};

int main() {
  size_t N, M;
  scanf("%zu %zu", &N, &M);

  std::map<std::string, size_t> vars;

  Graph<int> g(2*M);

  for (size_t i=0; i<N; ++i) {
    char buf[1024];
    scanf("%s", buf);
    std::string s=buf, t;
    std::vector<std::string> lits=preprocess(s, t);
    // assert(std::count(t.begin(), t.end(), '(') <= 1);

    for (const auto &lit: lits)
      if (vars.find(lit) == vars.end()) {
        size_t id=vars.size();
        vars.emplace(lit, id);
      }

    // fprintf(stderr, "%s\n", t.c_str());
    size_t j=0;
    Closure cur=parse(t, j);

    // if (cur & NOT_A) fprintf(stderr, "!");
    // fprintf(stderr, "%s", lits[0].c_str());
    // if (cur & ANY_OP) {
    //   assert(lits.size() == 2);
    //   assert(cur & ANY_B);
    //   fprintf(stderr, " %c ", (cur&OP_OR)? '|':'&');
    //   if (cur & NOT_B) fprintf(stderr, "!");
    //   fprintf(stderr, "%s", lits[1].c_str());
    // }
    // fprintf(stderr, "\n");

    size_t a=vars[lits.front()], b=vars[lits.back()];
    if (cur & OP_AND) {
      if (cur & A) {
        g.connect_to(M+a, a);
      } else {
        g.connect_to(a, M+a);
      }
      if (cur & B) {
        g.connect_to(M+b, b);
      } else {
        g.connect_to(b, M+b);
      }
    } else if (cur & OP_OR) {
      bool not_a=(cur&NOT_A), not_b=(cur&NOT_B);
      g.connect_to((not_a? 0:M)+a, (not_b? M:0)+b);
      g.connect_to((not_b? 0:M)+b, (not_a? M:0)+a);
    } else {
      if (cur & A) {
        g.connect_to(M+a, a);
      } else {
        g.connect_to(a, M+a);
      }
    }
  }

  std::vector<size_t> cmp=g.sccomp();
  for (size_t i=0; i<M; ++i)
    if (cmp[i] == cmp[i+M])
      return !printf("reject\n");

  printf("accept\n");
}



Measured memory_bytes: 3036