#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<(b)?(a=b,1):0)
#define chmin(a,b) (a>(b)?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef pair<int,int> pii;
typedef long long ll;

class SAT {
  vector<vector<int> > G,rG;
  vector<int> vs;
  int V,Vh;
  vector<bool> used;
  vector<int> cmp;
  void add_edge(int from, int to) {
    G[from].push_back(to);
    rG[to].push_back(from);
  }
  void dfs(int v) {
    used[v] = true;
    FOR(it, G[v]) if (!used[*it]) dfs(*it);
    vs.push_back(v);
  }
  void rdfs(int v, int k) {
    used[v] = true;
    cmp[v] = k;
    FOR(it, rG[v]) if (!used[*it]) rdfs(*it, k);
  }
  int scc() {
    used.assign(V,0);
    vs.clear();
    REP(v, V) if (!used[v]) dfs(v);
    used.assign(V,0);
    cmp.resize(V);
    int k = 0;
    for (int i=vs.size()-1; i>=0; --i) 
      if (!used[vs[i]]) rdfs(vs[i], k++);
    return k;
  }
public:
  void init(int Vnum) {
    Vh = Vnum;
    V = Vh*2;
    G.assign(V,vector<int>());
    rG.assign(V,vector<int>());    
  }
  SAT() {}
  SAT(int Vh) : Vh(Vh) {
    V = Vh*2;
    G.assign(V,vector<int>());
    rG.assign(V,vector<int>());
  }
  void add_closure(int a, int b) { // a or b
    add_edge(nt(b), a);
    add_edge(nt(a), b);
  }
  int nt(int a) {
    return a<Vh?a+Vh:a-Vh;
  }
  bool solve() {
    scc();
    REP(i,Vh) {
      if (cmp[i] == cmp[i+Vh]) return 0;
    }
    return 1;
  }
} sat;

map<string, int> mp;
int cnt;
string s;
int id;


struct P {
  int a, b;
  int f;                       // f=0 -> | , f=1 -> & , f=-1 -> solo
  P(int a) :a(a) {
    f = -1;
  }
  P(int a, int b, char c) :a(a),b(b) {
    if (c == '|') f = 0;
    else f = 1;
  }
  void negate() {
    if (f == -1) {
      a = sat.nt(a);
    } else {
      a = sat.nt(a);
      b = sat.nt(b);
      f = !f;
    }
  }
};
ostream& operator<<(ostream &os, const P &p) {
  if (p.f == -1) os << "solo : " << p.a;
  else if (p.f == 0) os << p.a << " | " << p.b;
  else os << p.a << " & " << p.b;
  return os;
}

P parse3();
P parse2();
P parse() {
  P left = parse2();
  if (s[id] == '|' || s[id] == '&') {
    char c = s[id];
    id++;
    P right = parse2();
    assert(left.f==-1&&right.f==-1);
    return P(left.a,right.a,c);
  }
  return P(left);
}

P parse2() {
  // not
  if (s[id] == '~') {
    int cnt = 0;
    while(s[id] == '~') {
      id++;
      cnt++;
    }
    P p = parse3();
    if (cnt&1)
      p.negate();
    return p;
  } else {
    return parse3();
  }
}

P parse3() {
  if (isalpha(s[id])) {
    string tmp;
    while(isalpha(s[id])) {
      tmp += s[id];
      id++;
    }
    if (mp.count(tmp) == 0) {
      mp[tmp] = cnt++;
    }
    return P(mp[tmp]);
  } else {
    assert(s[id] == '(');
    id++;
    P r = parse();
    assert(s[id++] = ')');
    return r;
  }
}

int main() {
  int n, m;
  while(cin >> n >> m) {
    cnt = 0;
    sat.init(m);
    REP(i,n) {
      cin >> s;
      s = s.substr(0,s.size()-1);
      id = 0;
      P r = parse();
      // cout << r << endl;
      if (r.f == -1) {
        sat.add_closure(r.a, r.a);
      } else if (r.f == 0) {
        sat.add_closure(r.a, r.b);
      } else {
        sat.add_closure(r.a, r.a);
        sat.add_closure(r.b, r.b);
      }
    }
    cout << (sat.solve()?"accept":"reject") << endl;
  }
}

Measured memory_bytes: 1352