#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

typedef int Weight;
struct Edge{
  int src, dst;
  Weight cost;
  Edge(int f, int t) : src(f), dst(t), cost(0) {}
  Edge(int f, int t, Weight c) : src(f), dst(t), cost(c) {}
};
bool operator<(const Edge& a, const Edge& b){
  return a.cost < b.cost;
}
bool operator>(const Edge& a, const Edge& b){
  return b < a;
}

// 隣接リスト
typedef vector<Edge> Node;
typedef vector<Node> Graph;

// 隣接行列
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

void add_edge(Graph& G, int src, int dst, Weight cost=0){
  //printf("add edge %d -> %d : %d", src, dst, cost);
  G[src].push_back(Edge(src, dst, cost));
}
// Strongly Connected Components(強連結成分)

// Step1
void SCC_dfs(const Graph& G, vector<bool>& visit, vector<int>& order, int v){
  visit[v] = true;
  REP(i, G[v].size()){
    int dst = G[v][i].dst;
    if(!visit[dst]) SCC_dfs(G, visit, order, dst);
  }
  order.push_back(v);
}

// Step2
Graph reverse_graph(const Graph& G){
  Graph revG(G.size());
  REP(i, G.size()){
    REP(j, G[i].size()){
      const Edge &e = G[i][j];
      revG[e.dst].push_back(Edge(e.dst, e.src, e.cost));
    }
  }
  return revG;
}

// Step3
void SCC_rdfs(const Graph& G, vector<bool>& visit, vector<int>& comp, int v, int k){
  visit[v] = true;
  REP(i, G[v].size()){
    int dst = G[v][i].dst;
    if(!visit[dst]) SCC_rdfs(G, visit, comp, dst, k);
  }
  comp[v] = k;
}

// 強連結成分分解
int SCC(const Graph& G, vector<int>& comp){
  Graph revG = reverse_graph(G);
  comp = vector<int>(G.size());
  vector<bool> visit(G.size());
  vector<int> order(G.size());
  int k = 0;
  REP(i, G.size()) if(!visit[i]) SCC_dfs(G, visit, order, i);
  reverse(order.begin(), order.end()); 

  visit = vector<bool>(G.size());
  REP(i, order.size()){
    if(!visit[order[i]]) SCC_rdfs(revG, visit, comp, order[i], k++);
  }
  return k;
}

struct SAT2{
  int n, N;
  Graph G;
  vector<int> truth;
  SAT2(){}
  SAT2(int n) : n(n), N(2 * n), G(N) {}
  void imply(int p, int q){
    add_edge(G, p, q);
  }
  void set_t(int p){
    imply(inv(p), p);
  }
  int inv(int p){ return (p + n) % N; }
  bool satisfy(){
    vector<int> comp;
    SCC(G, comp);
    truth.assign(n, false);
    for(int i = 0; i < n; i++){
      if(comp[i] == comp[i + n]) return false;
      if(comp[i] >  comp[i + n]) truth[i] = true;
    }
    return true;
  }
};
map<string, int> id;
int get_id(string s){
  if(id.count(s)) return id[s];
  int t = id.size();
  return id[s] = t;
}
struct Result{
  int a, b;
  int ope; // 0 - or 1 - and, -1 - none
  int p;
  Result(int a, int b, int ope, int p) : 
    a(a), b(b), ope(ope), p(p) {}
};
bool isope(char c){
  return c == '&' || c == '|';
}
int N, M;
SAT2 sat;
Result term(const string& s, int p);
Result expr(const string& s, int p){
  Result r = term(s, p);
  if(isope(s[r.p])){
    Result r_ = term(s, r.p + 1);
    if(s[r.p] == '|'){
      return Result(r.a, r_.a, 0, r_.p);
    }else{
      return Result(r.a, r_.a, 1, r_.p);
    }
  }
  return r;
}
Result term(const string& s, int p){
  if(s[p] == '('){
    Result r = expr(s, p + 1);
    assert(s[r.p] == ')');
    r.p++;
    return r;
  }else if(s[p] == '~'){
    Result r = term(s, p + 1);
    r.a = sat.inv(r.a);
    r.b = sat.inv(r.b);
    r.ope = (r.ope >= 0) ? (r.ope ^ 1) : -1;
    return r;
  }else if(isalpha(s[p])){
    string name;
    while(isalpha(s[p])) name += s[p++];
    return Result(get_id(name), 0, -1, p);
  }else{
    assert(false);
  }
}

int main(){
  while(cin >> M >> N){
    id.clear();
    sat = SAT2(N);
    REP(i, M){
      string s;
      cin >> s;
      Result r = expr(s.substr(0, s.size() - 1), 0);
      if(r.ope == -1){
        sat.set_t(r.a);
      }else if(r.ope == 0){
        sat.imply(sat.inv(r.a), r.b);
        sat.imply(sat.inv(r.b), r.a);
      }else if(r.ope == 1){
        sat.set_t(r.a);
        sat.set_t(r.b);
      }
    }
    if(sat.satisfy()) cout << "accept" << endl;
    else cout << "reject" << endl;
  }
  return 0;
}

Measured memory_bytes: 1352